boolean equals(Object obj)
boolean equalsIgnoreCase(String str)
boolean startsWith(String str)
boolean endsWith(String str)
eg:
String s1="hello";
String s2="hello";
s1.equals(s2); //true
int length()
char charAt(int index)
int indexOf(String str)
String substring(int start)
String substring(int start, int end)
char[] toCharArray()
String toLowerCase()
String toUpperCase()
eg:
String s="abcde";
char[] chs = s.toCharArray(); // chs={'a', 'b', 'c', 'd', 'e'}
String trim() // 去除字符串两端的空格
String[] split(String str)
StringBuilder append(任意类型)
StringBuilder reverse()
String toString(StringBuilder sb)
StringBuilder(String s) // String转换为StringBuilder
String s="abcde";
StringBuilder sb = new StringBuilder(s);
sb.reverse();
s = sb.toString(); // s="edcba"
String s="abcba";
StringBuilder sb = new StringBuilder(s);
sb.reverse();
boolearn = s.equals(sb.toString); //true
原文:https://www.cnblogs.com/selfdef/p/11061396.html