StringUtils.isBlank()的使用

在校验一个String类型的变量是否为空时,通常存在3中情况

是否为 null
是否为 “”
是否为空字符串(引号中间有空格) 如: " "。
制表符、换行符、换页符和回车

StringUtils的isBlank()方法可以一次性校验这三种情况,返回值都是true,否则为false

StringUtils.isBlank(image);
如果image为空,返回值为true
如果返回值不为空,返回值为false

//想要判断是不是空 一般下面两个就可以了
if(null == image || StringUtils.isBlank(image.getImage())){
map.put(“code”,“0”);
map.put(“msg”,“数据为空”);
return map;
}
原文地址:https://www.cnblogs.com/cxy2020/p/13804317.html