美文网首页
kotlin 空判断

kotlin 空判断

作者: kot_flu | 来源:发表于2019-07-26 09:14 被阅读0次

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

相关文章

网友评论

      本文标题:kotlin 空判断

      本文链接:https://www.haomeiwen.com/subject/venlrctx.html