fromChar

Creates a CodePoint from a single Char.

The resulting code point has the same code as char that is always in the range 0x0000 to 0xFFFF.

Since Kotlin

2.5

Return

A CodePoint with the same numeric value as char.

See also

Samples

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

fun main() { 
   //sampleStart 
   val char = 'Ü'
val codePoint1 = char.toCodePoint()
// or
val codePoint2 = CodePoint.fromChar(char)

println(codePoint1) // Ü
println(codePoint2) // Ü
// conversion from chars always result in basic code points
println(codePoint1.size) // 1
println("codePoint1.isBasic is ${codePoint1.isBasic}") // true 
   //sampleEnd
}