How to Remove Underscore and Sorted By CamelCase or TitleCase
Remove Underscore and Sorted By CamelCase or Titlecase
as like "TOP_UP_Wallet" to "Top Up Wallet"
fun Any.removeUnderscore(originalString: String): String? {
val str = originalString.lowercase(Locale.ROOT)
val stringWithoutUnderscores = str.replace("_", " ").split(" ").joinToString(" ") { it.replaceFirstChar {
if (it.isLowerCase()) it.titlecase(
Locale.ROOT
) else it.toString()
} }
return stringWithoutUnderscores
}
Now call this method From...