titlecaseChar

Platform and version requirements: JVM (1.5), JS (1.5), Native (1.5)
fun Char.titlecaseChar(): Char

Converts this character to title case using Unicode mapping rules of the invariant locale.

This function performs one-to-one character mapping. To support one-to-many character mapping use the titlecase function. If this character has no mapping equivalent, the result of calling uppercaseChar is returned.

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

fun main(args: Array<String>) {
//sampleStart
val chars = listOf('a', 'Dž', 'ʼn', '+', 'ß')
val titlecaseChar = chars.map { it.titlecaseChar() }
val titlecase = chars.map { it.titlecase() }
println(titlecaseChar) // [A, Dž, ʼn, +, ß]
println(titlecase) // [A, Dž, ʼN, +, Ss]
//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/titlecase-char.html