StringUtils.isNotEmpty() VS StringUtils.isNotBlank()
StringUtils.isNotEmpty() is used to find if the String is not empty and not null.
StringUtils.isNotBlank() takes it a step forward. It not only checks if the String is not empty and not null, but also checks if it is not only a whitespace string.
1) isNotEmpty
StringUtils.isNotEmpty(null) = false
StringUtils.isNotEmpty("") = false
StringUtils.isNotEmpty(" ") = true
StringUtils.isNotEmpty(" lol ") = true
StringUtils.isNotEmpty("lol") = true
2) isNotBlank
StringUtils.isNotBlank(null) = false
StringUtils.isNotBlank("") = false
StringUtils.isNotBlank(" ") = false
StringUtils.isNotBlank("lol") = true
StringUtils.isNotBlank(" lol ") = true
Thanks bro, its really usefull..:)
ReplyDeleteThank you so much....
ReplyDelete