以什么开头(真为true 假为false)
String string = "www.baidu.com"; boolean www = string.startsWith("www"); boolean www1 = string.startsWith("baidu"); boolean www2 = string.startsWith("baidu", 4);//从String长度几开始
结果
以什么结尾(真为true 假为false)
String string = "www.baidu.com"; boolean www = string.endsWith("www"); boolean www1 = string.endsWith("baidu"); boolean www2 = string.endsWith("com");
结果