kotlin isNotEmpty 和isNotBlank的区别【java字符串判空】

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/bobby_fu/article/details/82855505
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 
7 str.length > 0 && str.trim().length > 0  --->   str.length > 0

猜你喜欢

转载自blog.csdn.net/bobby_fu/article/details/82855505