Do not use myString == "" , in java it will be myString.equals("") , which is also not recommended.
isBlank not the same as isEmpty , and it really depends on your use case.
isBlank checks that the char sequence has a length of 0 or that all indexes are spaces. isEmpty only checks that the length of the char sequence is 0.
public fun CharSequence.isBlank(): Boolean = length == 0 || indices.all { this[it].isWhitespace() } @kotlin.internal.InlineOnly public inline fun CharSequence.isEmpty(): Boolean = length == 0
source share