In 1.5 `capitalize()` is deprecated and I'm prompt...
# random
r
In 1.5
capitalize()
is deprecated and I'm prompted to replaced it with
Copy code
replaceFirstChar { if (it.isLowerCase())
    it.titlecase(Locale.getDefault()) else it.toString() })
How's that better? I guess I'll re-create the shortcut myself ¯\_(ツ)_/¯
d
Yeah, those were locale sensitive and lead to surprises. Unless you're dealing with actual locale sensitive capitalisation, you want
Locale.ROOT
and that's what the new functions use: https://kotlinlang.org/docs/whatsnew15.html#stable-locale-agnostic-api-for-upper-lowercasing-text
💯 1
e
you are not gonna be the only one
r
@danny I am aware of this, still there could be a warning instead of deprecation...
g
no, it shouldn’t be a warning, this function just shouldn’t exist in stdlib, because .capitilize() without explicit locale is dangerous in all cases
☝️ 1
1