Here is an example for matching two strings using kotlin.
If you use == (double equals) to match the string, then it compares the address and returns the maximum time of the incorrect result according to the java documentation, so use equals for the same
If you want to use the equal case of ignoring , then pass true in the equals String method
if (s1.equals(s2,true))
another wise you can just use this without a boolean type
if (s1.equals(s2,false)) or if (s1.equals(s2))
completion code below
fun main(args: Array<String>) { val s1 = "abc" val s2 = "Abc" if (s1.equals(s2,true)) { println("Equal") } else { println("Not Equal") } }
Er maraj hussain
source share