equals

fun Char.equals(other: Char, ignoreCase: Boolean = false): Boolean(source)

Returns true if this character is equal to the other character, optionally ignoring character case.

Two characters are considered equal ignoring case if Char.uppercaseChar().lowercaseChar() on each character produces the same result.

Since Kotlin

1.0

Parameters

ignoreCase

true to ignore character case when comparing characters. By default false.

Samples

import java.util.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   println("'a'.equals('a', false) is ${'a'.equals('a', false)}") // true
println("'a'.equals('A', false) is ${'a'.equals('A', false)}") // false
println("'a'.equals('A', true) is ${'a'.equals('A', true)}") // true 
   //sampleEnd
}

expect fun String?.equals(other: String?, ignoreCase: Boolean = false): Boolean(source)

Returns true if this string is equal to