One, String class--describes the common methods of the string is briefly described:
1.charAt () Gets the character of the corresponding position
2.length () Gets the length of the string
3.concat () append content at the end of the string-----equivalent to a connector (+)
4.contains () to see if the string contains the specified content
5.endWith () to see if the string ends with XXX (can be used to view the file format)
6.startWith () to see if the string starts with XXX
7.equals () compare two strings for the same content
8.indexOf () find where a given content first appears
9.lastIndexOf () Find the last occurrence of a given content
10.replace () Replace the contents of the string
11.split () Cut string
12.trim () ignores headers and trailing spaces (middle cannot be ignored)
13.subString () Truncate substring
14.getBytes () string type-->byte[] Type
15.toCharArray () string type-->char[] Type
16.toLowerCase () string all lowercase
17.toUpperCase () string all uppercase
Second, StringBuffer and StringBuilder commonly used methods of simple introduction:
1.append () append content after StringBuffer and StringBuilder strings
2.insert () Add content at the specified location
3.delete () Delete content
4.reverse () Invert string
5.setCharAt () Change the content at the specified location
Iii. differences between String, StringBuffer, and StringBuilder
1.String: Immutable sequence of characters
2.StringBuffer: Variable sequence of characters, thread synchronization (safe), low efficiency
3.Stringbuilder: variable character sequence, is thread unsynchronized (insecure), high efficiency, is a simple replacement for StringBuffer (recommended)
"StringBuffer and StringBuilder is the memory optimization of string" "
Note: The method is more, do not introduce each one, give you a link "jdk1.6 Chinese version", download down can own view.
Java--string Class (Common Class)