Answers for "how to compare 2 strings in kotlin?"

0

kotlin compare strings

val hello = "Hello"
    val world = "World"

    // equals() returns true or false
    val equals = hello.equals(world)

    // compareTo() will return 0 if true
    // Any non zero value is false
    val compare = hello.compareTo(world)
Posted by: Guest on October-27-2020

Browse Popular Code Answers by Language