String類所有方法[轉]
方法摘要
char charAt(int index)
返回指定索引處的 char 值。
int codePointAt(int index)
返回指定索引處的字符(Unicode 代碼點)。
int codePointBefore(int index)
返回指定索引之前的字符(Unicode 代碼點)。
int codePointCount(int beginIndex, int endIndex)
返回此 String 的指定文本范圍中的 Unicode 代碼點數(shù)。
int compareTo(String anotherString)
按字典順序比較兩個字符串。
int compareToIgnoreCase(String str)
不考慮大小寫,按字典順序比較兩個字符串。
String concat(String str)
將指定字符串聯(lián)到此字符串的結尾。
boolean contains(CharSequence s)
當且僅當此字符串包含 char 值的指定序列時,才返回 true。
boolean contentEquals(CharSequence cs)
當且僅當此 String 表示與指定序列相同的 char 值時,才返回 true。
boolean contentEquals(StringBuffer sb)
當且僅當此 String 表示與指定的 StringBuffer 相同的字符序列時,才返回 true。
static String copyValueOf(char[] data)
返回指定數(shù)組中表示該字符序列的字符串。
static String copyValueOf(char[] data, int offset, int count)
返回指定數(shù)組中表示該字符序列的字符串。
boolean endsWith(String suffix)
測試此字符串是否以指定的后綴結束。
boolean equals(Object anObject)
比較此字符串與指定的對象。
boolean equalsIgnoreCase(String anotherString)
將此 String 與另一個 String 進行比較,不考慮大小寫。
static String format(Locale l, String format,