1、char charAt(int index)
返回指定索引处的 char
值。
2、int compareTo(String other) 按照字典顺序,如果字符串位于other之前,返回一个负数;如果字符串位于other之后,返回一个正数;如果两个字符串相等,返回0。
3、boolean endsWith(String suffix) 如果字符串以suffix结尾,返回true。
4、boolean equals(Object object) 如果字符串与object相等,返回true。
5、boolean equalsIgnoreCase(String other) 如果字符串与other相等(忽略大小写),返回true。
6、int indexOf(String str) 返回与字符串str匹配的第一个子串开始位置。这个位置从索引0开始计算。如果在原始串中不存在str,返回-1。
7、int lastIndexOf(String str) 返回与字符串str匹配的最后一个子串的开始位置。这个位置从原始串尾端开始计算。
8、int length() 返回字符串的长度
9、String replace(CharSequence oldString,CharSequence newString) 返回一个新的字符串,这个字符串用newString代替原始字符串中所有的oldString。
10、boolean startsWith(String prefix) 如果字符串以prefix字符串开始,返回true。
11、String substring(int beginIndex) 、String substring(int beginIndex, int endIndex) 返回一个新字符串。这个字符串包含原始字符串中从beginIndex 到串尾或endIndex–1的所有代码单元。
12、String toLowerCase( ) 返回一个新字符串。这个字符串将原始字符串中的所有大写字母改成了小写字母。
13、String toUpperCase( ) 返回一个新字符串。这个字符串将原始字符串中的所有小写字母改成了大写字母。
14、String trim( ) 返回一个新字符串。这个字符串将删除了原始字符串头部和尾部的空格。
String API的更多方法可以在http://tool.oschina.net/apidocs/apidoc?api=jdk-zh中了解。