本帖最后由 noiary 于 2014-10-16 16:56 编辑
自己简单整理了下String对象方法
- /*
- String Review
- */
- /*构造方法 Constructor summary*/
- /*方法摘要 Method summary*/
- 1. char charAt(int index);
- 2. int indexOf(char chs);
- 3. boolean compareTo(String str);
- 4. String concat(String str); //Concatenate
- 5. boolean contains(CharSequence s);
- 6. boolean startsWith
- startsWith(String prefix);
- startsWith(String prefix, int toffset)
- 7. boolean endsWith(String suffix);
- 8. boolean isEmpty(); //length()==0
- 9. int lastIndexOf(int ch); //int ch ? ?
- 10. String replace
- replace(char oldChar, char, newCaar):
- replace(CharSequence target, CharSequence replacement);
- replaceAll(String regex, String replacement);
- replaceFirst(String regex, String replacement);
- 11. String[] split
- split(String regex);
- split(String regex, int limit);
- 12. String subString
- subString(int beginIndex);
- subString(int beginIndex, int endIndex);
- 13. char[] toCharArray;
- 14. String toLowerCase();
- 15. String toUpperCase();
- 16. String trim(); //copy
- 17. static String valueOf(X x);
复制代码 |
|