StringUtils中 isNotEmpty 和isNotBlank的区别

isNotEmpty(str)等价于 str != null && str.length > 0
isNotBlank(str) 等价于 str != null && str.length > 0 && str.trim().length > 0
同理
isEmpty 等价于 str == null || str.length == 0
isBlank  等价于 str == null || str.length == 0 || str.trim().length == 0

str.length > 0 && str.trim().length > 0  --->   str.length > 0
 
StringUtils.isNotEmpty(null) = false
StringUtils.isNotEmpty("") = false
StringUtils.isNotEmpty(" ") = true
StringUtils.isNotEmpty(" ") = true
StringUtils.isNotEmpty("bob") = true
StringUtils.isNotEmpty(" bob ") = true


StringUtils.isNotBlank(null) = false
StringUtils.isNotBlank("") = false
StringUtils.isNotBlank(" ") = false
StringUtils.isNotBlank(" ") = false
StringUtils.isNotBlank("	 
 f 
") = false
StringUtils.isNotBlank("") = true
StringUtils.isNotBlank("bob") = true
StringUtils.isNotBlank(" bob ") = true
原文地址:https://www.cnblogs.com/chong-zuo3322/p/14087050.html