<@U74HWEPTP> may I know what is the correct or bes...
# codereview
a
@Shawn may I know what is the correct or best way of doing it?
p
What does
TextUtils.isEmpty(email)
do? Is it the same as
string.isEmpty()
? If yes, then you can write
Copy code
buttonRegister.isEnabled = email.isNotEmpty() && password.isNotEmpty() && confirmPassword.isNotEmpty()
g
I suppose
TextUtils.isEmpty
is from Android
android.text.TextUtils
, so it’s like isNullOrEmpty(), but for non-null variables in Kotlin it can be replaced with isNotEmpty()
a
@Pavlo Liapota
TextUtils
is a package in Android.
g
so instead you can use isEmpty(), isNotEmpty() or isNullOrEmpty(), depending on your use case and types
d
how about:
buttonRegister.isEnabled = listOf(email, password, confirmPassword).none { it.isNullOrEmpty() }
?
1
r
@digitalsanctum that’s real fancy. I like that.
👍 1