Skip to content

Instantly share code, notes, and snippets.

@EmmanuelGuther
Last active February 15, 2018 09:54
Show Gist options
  • Save EmmanuelGuther/4e85bb62311aa36640486eef3f99808f to your computer and use it in GitHub Desktop.
Save EmmanuelGuther/4e85bb62311aa36640486eef3f99808f to your computer and use it in GitHub Desktop.
When you want to make sure that a string starts with a capital letter and follows it lowercase
fun capitalizeFirstLetter(string: String?): String? = string?.substring(0, 1)?.toUpperCase() + string?.substring(1)?.toLowerCase()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment