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

关注博客,分享实用技术

发布了316 篇原创文章 · 获赞 103 · 访问量 43万+

猜你喜欢

转载自blog.csdn.net/qq_37022150/article/details/104751794
今日推荐