package String1;
public class test4 {
public static void main(String[] args)
{
String s = "helloworld";
//判断一个字符串是否以某一个字符串为后缀
boolean world = s.endsWith("world");
System.out.println(world);
String s1 = "helloworld";
//判断两个字符串的值是否相等
boolean equals = s.equals(s1);
System.out.println(equals);
//忽略大小写,判断两个字符串的值是否相等
String s2 = "HELLOWORLD";
boolean b = s.equalsIgnoreCase(s2);
System.out.println(b);
//判断一个字符串是否包含一个子字符串
boolean hello = s.contains("oworg");
System.out.println(hello);
//判断一个字符串是否以某一个字符串为前缀
boolean hello1 = s.startsWith("hello");
System.out.println(hello1);
//判断一个字符串是否是空串
boolean empty = s.isEmpty();
System.out.println(empty);
}
}