[K/N] Deprecate old Char and String case conversion api #KT-43023
This commit is contained in:
@@ -150,6 +150,8 @@ public actual fun Char.isTitleCase(): Boolean {
|
||||
/**
|
||||
* Converts this character to upper case using Unicode mapping rules of the invariant locale.
|
||||
*/
|
||||
@Deprecated("Use uppercaseChar() instead.", ReplaceWith("uppercaseChar()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public actual fun Char.toUpperCase(): Char = uppercaseCharImpl()
|
||||
|
||||
/**
|
||||
@@ -182,6 +184,8 @@ public actual fun Char.uppercase(): String = uppercaseImpl()
|
||||
/**
|
||||
* Converts this character to lower case using Unicode mapping rules of the invariant locale.
|
||||
*/
|
||||
@Deprecated("Use lowercaseChar() instead.", ReplaceWith("lowercaseChar()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public actual fun Char.toLowerCase(): Char = lowercaseCharImpl()
|
||||
|
||||
/**
|
||||
|
||||
@@ -201,6 +201,8 @@ private fun String.unsafeRangeEqualsIgnoreCase(thisOffset: Int, other: String, o
|
||||
/**
|
||||
* 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")
|
||||
public actual fun String.toUpperCase(): String = uppercaseImpl()
|
||||
|
||||
/**
|
||||
@@ -218,6 +220,8 @@ public actual fun String.uppercase(): String = uppercaseImpl()
|
||||
/**
|
||||
* 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")
|
||||
public actual fun String.toLowerCase(): String = lowercaseImpl()
|
||||
|
||||
/**
|
||||
@@ -249,6 +253,8 @@ private external fun toCharArray(string: String, start: Int, size: Int): CharArr
|
||||
*
|
||||
* @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() && this[0].isLowerCase()) substring(0, 1).toUpperCase() + substring(1) else this
|
||||
}
|
||||
@@ -259,6 +265,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() && !this[0].isLowerCase()) substring(0, 1).toLowerCase() + substring(1) else this
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user