package stringexample;
import org.junit.Test;
/*一:
* public int lenth();
* public char charAt(int index):返回在指定index位置的字符,index从零开始
* public boolean equals(Object anobject)
* public int compareTo (String anotherString):
* 比较两个字符串的字符,用较短的字符串中的字符和长字符串中的字符相减得到一个数值,一般用于排序
* public int indexOf(String s):返回字符串s在当前字符串首次出现的位置,若没有则返回-1
* public int indexOf(String s,int startpoint):从startpoint开始首次出现的位置
* public int lastindexOf(String s):返回字符串s在当前字符串最后一次出现的位置,若没有则返回-1
* public int lastindexOf(String s,int startpoint)
* public boolean startwith(String prefix)
* public boolean endwith(String suffix)
* public boolean regionMatchea(int firstStart,String other,int otherStart,int lenth)
* 判断当前字符串从firstStart开始的子串与另一个字符串other从otherStart开始,lenth长度的字符串是否equals。
*
* 二:
* public String substring(int startpoint)
* public String substring(int startpoint,int end):返回从start开始到end结束的一个左闭右开的字符串
* public String replace(char oldchar, char newchar)
* public String replaceAll(String old,String new)
* public String trim();去除首尾出现的空格,有多个就去除多个
* public String concat(String str);连接当前字符串和str
* public String[] split(String regex)
* public boolean contains(CharSequence s)
* 当且仅当此字符串包含指定的char值序列时才返回true,判断当前字符串有没有包含字符串s。
*/
public class StringMethod {
@Test
public void test1()
{
}
}