Comparison of String, StringBuffer and StringBuilder in Java and source code analysisIt is well known that string, StringBuffer, and StringBuilder are common strings in Java, and I will compare the three brothers in three ways.the data organization
String source code analysis, string source code
The String class maintains a char [] type value to store strings. The source code is relatively simpler.1. Immutable
The immutability of String is mainly reflected in three aspects:
The String class
First, it refers to the string SEARCH, that is, to find the position where A specified string B appears in A specified string A, or to count the number of times other B appears in. ①MS provides a strstr function prototype: extern char * strstr
In the past, we used to talk about php string encoding conversion. Next I will introduce the Character String Conversion and encoding program in java. If you need to know about it, please refer to it.
1. The popular character encoding formats
Overview
LUA is fully 8-bit encoded, and the characters in the LUA string can have any numeric encoding, including a value of 0. That is, any binary data can be stored in a string. The LUA string is immutable (immutable values). If you modify it,
1. The popular character encoding formats include: US-ASCII, ISO-8859-1, UTF-8, UTF-16BE, UTF-16LE, UTF-16, GBK, GB2312, etc.GBK and GB2312 are specially used for Chinese encoding.2. The getBytes method of String is used to obtain the byte array of
I think there are three core points in the source code reading: technical foundation + strong curiosity + patience.
Speaking of the technical foundation, let me give you an example. If you have never learned Java or any programming language such as
My understanding of java String and source code analysis, javastring
Abstract: Original Source: http://www.cnblogs.com/Alandre/ sediment tile pulp carpenter hope to reprint, retain abstract, thank you!Get up every day and tell yourself that your
1. ClassificationBasic properties: String The final attribute is a char[] value; Construct method area: More complex is constructed by Unicode code and byte[]; string comparisons: Equality, size (sort); query: IndexOf, StartsWith, Endwith, contains
Format
Camelize | capitalize|Underscore|Dasherize|Inspect
Deformation
ToArray|Succ|Times
One useful method here is inspect. According to the instructions in the reference manual, this function is to "return the representation of
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.