String API Reference
Swift's String — a value type representing a sequence of Unicode scalar values (extended grapheme clusters).
String
A Unicode string value that is a collection of characters. A value type bridged to NSString.
String.count -> IntThe number of characters (extended grapheme clusters) in the string.
Returns: Int
String.uppercased() -> StringReturns a new string made by replacing lowercase characters with uppercase ones.
Returns: String
String.lowercased() -> StringReturns a new string made by replacing uppercase characters with lowercase ones.
Returns: String
String.hasPrefix(_ prefix: String) -> BoolReturns a Boolean indicating whether the string begins with the specified prefix.
Returns: Bool
String.hasSuffix(_ suffix: String) -> BoolReturns a Boolean indicating whether the string ends with the specified suffix.
Returns: Bool
String.contains(_ other: String) -> BoolReturns true if the string contains the given string or character.
Returns: Bool
String.split(separator: Character) -> [Substring]Returns the longest possible subsequences of the string, in order, around the separator.
Returns: [Substring]
String.replacingOccurrences(of: String, with: String) -> StringReturns a new string in which all occurrences of a target string are replaced by another.
Returns: String