Fix titlecase lowering in decapitalize

Replace isUpperCase() with !isLowerCase check to lower both
upper- and titlecased first chars.
This commit is contained in:
Ilya Gorbunov
2019-05-29 03:52:36 +03:00
parent a921bd04e0
commit 8badfca459
2 changed files with 5 additions and 1 deletions
@@ -609,7 +609,7 @@ public actual fun String.decapitalize(): String {
@SinceKotlin("1.3")
@ExperimentalStdlibApi
public fun String.decapitalize(locale: Locale): String {
return if (isNotEmpty() && this[0].isUpperCase()) substring(0, 1).toLowerCase(locale) + substring(1) else this
return if (isNotEmpty() && !this[0].isLowerCase()) substring(0, 1).toLowerCase(locale) + substring(1) else this
}
/**