StringUtils中的isNotBlank()与isNotEmpty()的区别

public class UtilsTest {
@org.junit.Test
public void Test() {
String str1=null;
String str2="";
String str3=" ";
String str4="framework";

System.out.println(StringUtils.isNotBlank(str1));
System.out.println(StringUtils.isNotBlank(str2));
System.out.println("str3的长度"+str3.length()+StringUtils.isNotBlank(str3));
System.out.println(StringUtils.isNotBlank(str4));
System.out.println("----------------------------");
System.out.println(StringUtils.isNotEmpty(str1));
System.out.println(StringUtils.isNotEmpty(str2));
System.out.println("str3的长度"+str3.length()+StringUtils.isNotEmpty(str3));
System.out.println(StringUtils.isNotEmpty(str4));

}
}

false
false
str3的长度1false
true
----------------------------
false
false
str3的长度1true
true

猜你喜欢

转载自www.cnblogs.com/framework2018/p/9427939.html