string compare to in kotlin code example

Example 1: kotlin compare string

val first = "code"
val second = "code"
val firstCapitalized = "Code"
// with ==
assertTrue { first == second }							
assertFalse { first == firstCapitalized }
// with equals
assertTrue { first.equals(second) }						
assertFalse { first.equals(firstCapitalized) }
assertTrue { first.equals(firstCapitalized, true) }		// ignores case
// with compareTo
assertTrue { first.compareTo(second) == 0 }
assertTrue { first.compareTo(firstCapitalized) == 32 }
assertTrue { firstCapitalized.compareTo(first) == -32 }
assertTrue { first.compareTo(firstCapitalized, true) == 0 }

Example 2: compare 2 strings kotlin

string1 == string2 //returns true if they are equal and false if they are not