isNotblank和isNotEmpty的区别

1 isNotEmpty(str)等价于 str != null && str.length > 0
2 isNotBlank(str) 等价于 str != null && str.length > 0 && str.trim().length > 0
3 同理
4 isEmpty 等价于 str == null || str.length == 0
5 isBlank 等价于 str == null || str.length == 0 || str.trim().length == 0
6. str.trim().length的意思是获得一个字符串除去空格之后的长度,因为空字符串也有长度可言!

猜你喜欢

转载自blog.csdn.net/weixin_39638459/article/details/85274490