To check if two strings are equal ignoring case in Kotlin, you can use the equals
function with the ignoreCase
parameter set to true
.
In this example,
str1
and str2
with the values "Hello"
and "hello"
respectively.equals
function on str1
with str2
and ignoreCase
set to true
to check if they are equal ignoring case.fun main() {
val str1 = "Hello"
val str2 = "hello"
val result = str1.equals(str2, ignoreCase = true)
println("Are strings equal ignoring case? $result")
}
Are strings equal ignoring case? true
In this tutorial, we learned How to check if Two Strings are Equal ignoring case in Kotlin language with well detailed examples.