isNotBlank 相当于不为null,不为“”,是否为“”
代替了!=null||!"".equals("")
import org.apache.commons.lang3.StringUtils;
// TODO Auto-generated method stub
StringBuffer sb = new StringBuffer();
String errorMsg = sb.toString();
errorMsg=null;
System.out.println(StringUtils.isNotBlank(errorMsg));
System.out.println(errorMsg!=null&&!"".equals(errorMsg));
}
+2016年06月02日+
isNotEmpty将空格也作为参数,isNotBlank则排除空格参数
本文探讨了Apache Commons Lang库中isNotBlank与isNotEmpty方法的区别。isNotBlank用于判断字符串是否非空且非空白字符,而isNotEmpty则进一步考虑了空字符串的情况。通过示例代码对比了两种方法的应用。

1万+

被折叠的 条评论
为什么被折叠?



