@Test
public void test01(){
String s1 = null; // null对象
String s2 = ""; // 空串
String s3 = " "; // 带空格
System.out.println("s1:"+ StringUtils.hasText(s1));
System.out.println("s2:"+ StringUtils.hasText(s2));
System.out.println("s3:"+ StringUtils.hasText(s3));
}
/*
控制台输出:
s1:false
s2:false
s3:false
*/
用 StringUtils.hasText() 代替
StringUtils.isEmpty() 过期了,用什么替换?
最新推荐文章于 2023-09-02 01:08:04 发布