Check out example codes for "kotlin compare strings". It will help you in understanding the concepts better.

Code Example 1

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)

Learn ReactJs, React Native from akashmittal.com