Deprecate old Char and String case conversion api #KT-43023
This commit is contained in:
@@ -8,7 +8,8 @@ package kotlin.text
|
||||
/**
|
||||
* Converts this character to lower case using Unicode mapping rules of the invariant locale.
|
||||
*/
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
@Deprecated("Use lowercaseChar() instead.", ReplaceWith("lowercaseChar()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Char.toLowerCase(): Char = lowercaseChar()
|
||||
|
||||
@@ -44,7 +45,8 @@ public actual inline fun Char.lowercase(): String = toString().asDynamic().toLow
|
||||
/**
|
||||
* Converts this character to upper case using Unicode mapping rules of the invariant locale.
|
||||
*/
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
@Deprecated("Use uppercaseChar() instead.", ReplaceWith("uppercaseChar()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun Char.toUpperCase(): Char = uppercaseChar()
|
||||
|
||||
|
||||
@@ -171,6 +171,8 @@ public actual fun String.encodeToByteArray(
|
||||
/**
|
||||
* Returns a copy of this string converted to upper case using the rules of the default locale.
|
||||
*/
|
||||
@Deprecated("Use uppercase() instead.", ReplaceWith("uppercase()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun String.toUpperCase(): String = asDynamic().toUpperCase()
|
||||
|
||||
@@ -190,6 +192,8 @@ public actual inline fun String.uppercase(): String = asDynamic().toUpperCase()
|
||||
/**
|
||||
* Returns a copy of this string converted to lower case using the rules of the default locale.
|
||||
*/
|
||||
@Deprecated("Use lowercase() instead.", ReplaceWith("lowercase()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun String.toLowerCase(): String = asDynamic().toLowerCase()
|
||||
|
||||
|
||||
@@ -83,6 +83,8 @@ public actual fun CharSequence.regionMatches(thisOffset: Int, other: CharSequenc
|
||||
*
|
||||
* @sample samples.text.Strings.capitalize
|
||||
*/
|
||||
@Deprecated("Use replaceFirstChar instead.", ReplaceWith("replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public actual fun String.capitalize(): String {
|
||||
return if (isNotEmpty()) substring(0, 1).toUpperCase() + substring(1) else this
|
||||
}
|
||||
@@ -93,6 +95,8 @@ public actual fun String.capitalize(): String {
|
||||
*
|
||||
* @sample samples.text.Strings.decapitalize
|
||||
*/
|
||||
@Deprecated("Use replaceFirstChar instead.", ReplaceWith("replaceFirstChar { it.lowercase() }"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public actual fun String.decapitalize(): String {
|
||||
return if (isNotEmpty()) substring(0, 1).toLowerCase() + substring(1) else this
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user