The capitalized
property of a string in Swift returns the same string with the first character from each word, in the string, changed to its corresponding uppercase value. All remaining characters of the string are set to their corresponding lowercase values.
string.capitalized
This property returns a string with the first character of each word, in the string, changed to its corresponding uppercase value and all remaining characters set to their corresponding lowercase values.
// import Foundationimport Foundation// create some stringslet name = "theodore"let language = "swift"let greeting = "edpresso is the best!"// use the capitalized propertyprint(name.capitalized) // Theodoreprint(language.capitalized) // Swiftprint(greeting.capitalized) // Edpresso Is The Best!
Foundation
framework. This framework allows us to access some properties and methods of the string and other data types. We need it to access the capitalized
property.Free Resources