isLetter
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.
Since Kotlin
1.0Samples
import java.util.*
import kotlin.test.*
fun main() {
//sampleStart
val chars = listOf('a', 'β', '+', '1')
val (letters, notLetters) = chars.partition { it.isLetter() }
println(letters) // [a, β]
println(notLetters) // [+, 1]
//sampleEnd
}
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.
Since Kotlin
1.3Samples
import java.util.*
import kotlin.test.*
fun main() {
//sampleStart
val chars = listOf('a', 'β', '+', '1')
val (letters, notLetters) = chars.partition { it.isLetter() }
println(letters) // [a, β]
println(notLetters) // [+, 1]
//sampleEnd
}