Skip to content

Instantly share code, notes, and snippets.

@tkausch
Created September 18, 2020 15:58
Show Gist options
  • Save tkausch/6a30fcacee01d6e6ba1dd06d53eee02c to your computer and use it in GitHub Desktop.
Save tkausch/6a30fcacee01d6e6ba1dd06d53eee02c to your computer and use it in GitHub Desktop.
How to capitalize words in a string using capitalized
// Swift offers several ways of adjusting the letter case of a string,
// but if you're looking for title case – that is, Text Where The First Letter Of Each String Is Capitalized -
// then you need to use the capitalized property, like this:
let str = "apple, banana, drink's fever"
print(str.capitalized)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment