StringUtils里的isEmpty方法和isBlank方法的区别
StringUtils.isEmpty("yyy") = false
StringUtils.isEmpty("") = true
StringUtils.isEmpty(" ") = false
StringUtils.isBlank("yyy") = false
StringUtils.isBlank("") = true
StringUtils.isBlank(" ") = true
区别:
isEmpty:没有忽略空格参数,是以是否为空和是否存在为判断依据;
isBlank:在 isEmpty 的基础上进行了为空(字符串都为空格、制表符、tab 的情况)的判断。
总结:
isBlank:可以有空格;
isEmpty:不能有空格。
本文来自博客园,作者:ICE-CREAMMM,转载请注明原文链接:https://www.cnblogs.com/gsxm/p/16186795.html