1、
返回指定字符在此字符串中第一次出现处的索引。
Int indexOf(int ch)
返回指定字符在此字符串中第一次出现处的索引。
2、
从指定的索引开始搜索,返回在此字符串中第一次出现指定字符处的索引。
Int indexOf(int ch, int fromIndex)
从指定的索引开始搜索,返回在此字符串中第一次出现指定字符处的索引。
例如:
"unhappy".substring(2) returns "happy"
"Harbison".substring(3) returns "bison"
"emptiness".substring(9) returns "" (an empty string)
6、
返回一个新字符串,它是此字符串的一个子字符串。该子字符串从指定的
String substring
(int beginIndex, int endIndex)
返回一个新字符串,它是此字符串的一个子字符串。该子字符串从指定的
beginIndex
处开始,一直到索引
endIndex - 1
处的字符。因此,该子字符串的长度为
endIndex-beginIndex
。
示例:
"hamburger".substring(4, 8) returns "urge"
"smiles".substring(1, 5) returns "mile"
12、 boolean equals(Object anObject)
比较此字符串与指定的对象。