Kotlin equivalent of Java's equalsIgnoreCase

What is the equivalent of Java equalsIgnoreCase in Kotlin to compare String values?

I have used equals but it's not case insensitive.


You can use equals but specify ignoreCase parameter:

"example".equals("EXAMPLE", ignoreCase = true)

As per the Kotlin Documentation :

fun String?.equals(
    other: String?, 
    ignoreCase: Boolean = false
): Boolean

https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/equals.html

For Example:

val name: String = "Hitesh"
when{
name.equals("HITESH", true) -> {
                                // DO SOMETHING
    }
}

@hluhovskyi's answer is correct, however to use it on EditText or TextView, use following -

etPassword.text.toString().equals(etConfirmPassword.text.toString(), ignoreCase = true)