category

Returns the Unicode general category of the Unicode character corresponding to this code point.

Since Kotlin

2.5

Samples

import kotlin.text.unicode.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   val codePoint1 = CodePoint.fromChar('!')
println(codePoint1.category) // OTHER_PUNCTUATION
println("codePoint1 in CharCategory.OTHER_PUNCTUATION is ${codePoint1 in CharCategory.OTHER_PUNCTUATION}") // true
println("codePoint1 !in CharCategory.LOWERCASE_LETTER is ${codePoint1 !in CharCategory.LOWERCASE_LETTER}") // true

val codePoint2 = CodePoint(0x1d7f9) // MATHEMATICAL MONOSPACE DIGIT THREE
println(codePoint2.category) // DECIMAL_DIGIT_NUMBER 
   //sampleEnd
}

Returns the Unicode general category of the Unicode character corresponding to this code point.

Since Kotlin

2.5

Samples

import kotlin.text.unicode.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   val codePoint1 = CodePoint.fromChar('!')
println(codePoint1.category) // OTHER_PUNCTUATION
println("codePoint1 in CharCategory.OTHER_PUNCTUATION is ${codePoint1 in CharCategory.OTHER_PUNCTUATION}") // true
println("codePoint1 !in CharCategory.LOWERCASE_LETTER is ${codePoint1 !in CharCategory.LOWERCASE_LETTER}") // true

val codePoint2 = CodePoint(0x1d7f9) // MATHEMATICAL MONOSPACE DIGIT THREE
println(codePoint2.category) // DECIMAL_DIGIT_NUMBER 
   //sampleEnd
}