//equals 在比较字符串时大小写敏感,equalslgnoreCase 在比较字符串相等时会忽略大小写,isEmpty是字符串的判空判断
package com.test.simple;
public class TestEqualForStr {
public static String str1 = "iuserdomain";
public static String str2 = "IUSERDOMAIN";
public static boolean testEquals(String s1, String s2){
boolean isTrue = s1.equals(s2);
return isTrue;
}
public static boolean testEqualsIgnoreCase(String s1, String s2){
boolean isTrue = s1.equalsIgnoreCase(s2);
return isTrue;
}
public static boolean testIsEmpty(String s1){
boolean isTrue = s1.isEmpty();
return isTrue;
}
public static void main(String str[]){
System.out.println(testEquals(str1, str2));
System.out.println(testEqualsIgnoreCase(str1, str2));
System.out.println(testIsEmpty(""));
}
}
false
true
true