1、org.springframework.util包下的 StringUtils.hasText()
StringUtils.hasText():如果字符序列不为 null 值,并且字符序列的长度大于 0 ,并且不含有空白字符序列,则返回 true
public static void main(String[] args) { Boolean a = StringUtils.hasText(null); System.out.println(a);//false Boolean a1 = StringUtils.hasText(""); System.out.println(a1);//false Boolean a2 = StringUtils.hasText(" "); System.out.println(a2);//false Boolean a3 = StringUtils.hasText(" ,"); System.out.println(a3);//true }
原文:https://www.cnblogs.com/wueryuan/p/14750223.html