How to capitalize each word in a string using Swift iOS

Are you looking for capitalizedString

Discussion
A string with the first character in each word changed to its corresponding uppercase value, and all remaining characters set to their corresponding lowercase values.

and/or capitalizedStringWithLocale(_:)

Returns a capitalized representation of the receiver using the specified locale.

For strings presented to users, pass the current locale ([NSLocale currentLocale]). To use the system locale, pass nil.

Leave a Comment