capitalize

fun String.capitalize(): String

Returns a copy of this string having it's first letter title cased using the rules of the default locale, or the original string if it's empty or already starts with a title case letter.

The title case of a character is usually the same as its upper case with several exceptions. The particular list of characters with the special title case form depends on the underlying platform.

Example:

val name = "john"
name.capitalize() // John

Since

1.1.0

See also

capitalize