Commonize Char.titlecaseChar() and Char.titlecase() #KT-44369

This commit is contained in:
Abduqodiri Qurbonzoda
2021-03-01 21:49:11 +03:00
parent 0c9205423f
commit 2266cd4631
15 changed files with 195 additions and 42 deletions
+27
View File
@@ -193,6 +193,33 @@ public expect fun Char.uppercaseChar(): Char
@ExperimentalStdlibApi
public expect fun Char.uppercase(): String
/**
* 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.
*
* @sample samples.text.Chars.titlecase
*/
@SinceKotlin("1.4")
@ExperimentalStdlibApi
public expect fun Char.titlecaseChar(): Char
/**
* Converts this character to title case using Unicode mapping rules of the invariant locale.
*
* This function supports one-to-many character mapping, thus the length of the returned string can be greater than one.
* For example, `'\uFB00'.titlecase()` returns `"\u0046\u0066"`,
* where `'\uFB00'` is the LATIN SMALL LIGATURE FF character (`ff`).
* If this character has no title case mapping, the result of [uppercase] is returned instead.
*
* @sample samples.text.Chars.titlecase
*/
@SinceKotlin("1.4")
@ExperimentalStdlibApi
public fun Char.titlecase(): String = titlecaseImpl()
/**
* Concatenates this Char and a String.
*