endsWith

Returns true if this char sequence ends with the specified character.

fun CharSequence.endsWith(char: Char, ignoreCase: Boolean = false): Boolean(source)
fun main() {
    val word = "Kotlin"

    println(word.endsWith('n'))               // true
    println(word.endsWith('N'))               // false
    println(word.endsWith('N', ignoreCase = true)) // true
}

Source