Stabilize new string and char case conversion API KT-45873
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -21,10 +21,10 @@ public actual inline fun Char.toLowerCase(): Char = lowercaseChar()
|
||||
*
|
||||
* @sample samples.text.Chars.lowercase
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.5")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Char.lowercaseChar(): Char = toString().asDynamic().toLowerCase().charCodeAt(0).unsafeCast<Int>().toChar()
|
||||
public actual inline fun Char.lowercaseChar(): Char = lowercase()[0]
|
||||
|
||||
/**
|
||||
* Converts this character to lower case using Unicode mapping rules of the invariant locale.
|
||||
@@ -36,10 +36,10 @@ public actual inline fun Char.lowercaseChar(): Char = toString().asDynamic().toL
|
||||
*
|
||||
* @sample samples.text.Chars.lowercase
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.5")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Char.lowercase(): String = toString().asDynamic().toLowerCase() as String
|
||||
public actual inline fun Char.lowercase(): String = toString().asDynamic().toLowerCase().unsafeCast<String>()
|
||||
|
||||
/**
|
||||
* Converts this character to upper case using Unicode mapping rules of the invariant locale.
|
||||
@@ -57,8 +57,8 @@ public actual inline fun Char.toUpperCase(): Char = uppercaseChar()
|
||||
*
|
||||
* @sample samples.text.Chars.uppercase
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.5")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public actual fun Char.uppercaseChar(): Char {
|
||||
val uppercase = uppercase()
|
||||
return if (uppercase.length > 1) this else uppercase[0]
|
||||
@@ -74,10 +74,10 @@ public actual fun Char.uppercaseChar(): Char {
|
||||
*
|
||||
* @sample samples.text.Chars.uppercase
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.5")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Char.uppercase(): String = toString().asDynamic().toUpperCase() as String
|
||||
public actual inline fun Char.uppercase(): String = toString().asDynamic().toUpperCase().unsafeCast<String>()
|
||||
|
||||
/**
|
||||
* Converts this character to title case using Unicode mapping rules of the invariant locale.
|
||||
@@ -89,7 +89,6 @@ public actual inline fun Char.uppercase(): String = toString().asDynamic().toUpp
|
||||
* @sample samples.text.Chars.titlecase
|
||||
*/
|
||||
@SinceKotlin("1.5")
|
||||
@ExperimentalStdlibApi
|
||||
public actual fun Char.titlecaseChar(): Char = titlecaseCharImpl()
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -180,8 +180,8 @@ public actual inline fun String.toUpperCase(): String = asDynamic().toUpperCase(
|
||||
*
|
||||
* @sample samples.text.Strings.uppercase
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.5")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun String.uppercase(): String = asDynamic().toUpperCase()
|
||||
|
||||
@@ -199,8 +199,8 @@ public actual inline fun String.toLowerCase(): String = asDynamic().toLowerCase(
|
||||
*
|
||||
* @sample samples.text.Strings.lowercase
|
||||
*/
|
||||
@SinceKotlin("1.4")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.5")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun String.lowercase(): String = asDynamic().toLowerCase()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user