Extended ProtocolSwift
StringProtocol
extension StringProtocol
Topics
Instance Properties
var capitalized: StringA copy of the string with each word changed to its corresponding capitalized spelling.var localizedCapitalized: StringA capitalized representation of the string that is produced using the current locale.var localizedLowercase: StringA lowercase version of the string that is produced using the current locale.var localizedUppercase: StringAn uppercase version of the string that is produced using the current locale.
Instance Methods
func capitalized(with: Locale?) -> StringReturns a capitalized representation of the string using the specified locale.func components<T>(separatedBy: T) -> [String]Returns an array containing substrings from the string that have been divided by the given separator.func data(using: String.Encoding, allowLossyConversion: Bool) -> Data?Returns aDatacontaining a representation of theStringencoded using a given encoding.func lineRange(for: some RangeExpression<String.Index>) -> Range<Self.Index>Returns the range of characters representing the line or lines containing a given range.func lowercased(with: Locale?) -> StringReturns a version of the string with all letters converted to lowercase, taking into account the specified locale.func paragraphRange(for: some RangeExpression<String.Index>) -> Range<Self.Index>Returns the range of characters representing the paragraph or paragraphs containing a given range.func uppercased(with: Locale?) -> StringReturns a version of the string with all letters converted to uppercase, taking into account the specified locale.func write(to: URL, atomically: Bool, encoding: String.Encoding) throwsWrites the contents of theStringto the URL specified by url using the specified encoding.func write<T>(toFile: T, atomically: Bool, encoding: String.Encoding) throwsWrites the contents of theStringto a file at a given path using a given encoding.