isLetter

Platform and version requirements: JVM (1.0), JS (1.5), Native (1.3)
fun Char.isLetter(): Boolean

Returns true if this character is a letter.

A character is considered to be a letter if its category is CharCategory.UPPERCASE_LETTER, CharCategory.LOWERCASE_LETTER, CharCategory.TITLECASE_LETTER, CharCategory.MODIFIER_LETTER, or CharCategory.OTHER_LETTER.

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

fun main(args: Array<String>) {
//sampleStart
val chars = listOf('a', 'β', '+', '1')
val (letters, notLetters) = chars.partition { it.isLetter() }
println(letters) // [a, β]
println(notLetters) // [+, 1]
//sampleEnd
}

© 2010–2021 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/is-letter.html