I want check value of my EditText in android so I saw two function for my String value :
user.isNullOrBlank()
and
user.isNullOrEmpty()
what is difference between them?
I want check value of my EditText in android so I saw two function for my String value :
user.isNullOrBlank()
and
user.isNullOrEmpty()
what is difference between them?
isNullOrBlank() takes whitespace into account:
fun main() {
val thisIsBlank = " "
println(thisIsBlank.isNullOrEmpty())
println(thisIsBlank.isNullOrBlank())
}
This prints:
false
true
because thisIsBlank is not empty, but it is blank.
isNullOrEmpty()
isNullOrBlank()