titlecase
Converts this code point to title case using Unicode mapping rules of the invariant locale.
This function supports one-to-many character mapping, thus the returned string can contain more than one code point. For example, CodePoint(0xFB00).titlecase() returns "\u0046\u0066", where '\uFB00' is the LATIN SMALL LIGATURE FF character (ff). If this code point has no title case mapping, the result of uppercase is returned instead.
Since Kotlin
2.5Samples
import kotlin.text.unicode.*
import kotlin.test.*
fun main() {
//sampleStart
val codePoints = "a+Džʼnß𐐨".asCodePointSequence()
val titlecaseCodePoints = codePoints.map { it.titlecaseCodePoint() }.toList()
val titlecase = codePoints.map { it.titlecase() }.toList()
println(titlecaseCodePoints) // [A, +, Dž, ʼn, ß, 𐐀]
println(titlecase) // [A, +, Dž, ʼN, Ss, 𐐀]
//sampleEnd
}Content copied to clipboard