/**
*查找特定的子串
*/
public class FindSubstring{
public static void main(String[] args){
String str="Welcome the body.";
System.out.println("Find the substring boy occurrence:"+str.indexOf("boy"));//查找子串
System.out.println("Find the substring by occurrence: "+str.indexOf("by"));//查找子串
System.out.println("Find the char t occurrence: "+str.indexOf('t'));//查找特定的字符
System.out.println("Test the string begin with wel.:"+str.startsWith("wel"));//是否以"wel"开始
System.out.pritnln("Test the string end with body.:"+str.endWith("boy"));//是否以"boy"结束
}
}