var decomposedStringWithCanonicalMapping: String
A string created by normalizing the string’s contents using Form D.
var decomposedStringWithCompatibilityMapping: String
A string created by normalizing the string’s contents using Form KD.
var fastestEncoding: String.Encoding
The fastest encoding to which the string can be converted without loss of information.
var precomposedStringWithCanonicalMapping: String
A string created by normalizing the string’s contents using Form C.
var precomposedStringWithCompatibilityMapping: String
A string created by normalizing the string’s contents using Form KC.
var removingPercentEncoding: String?
A new string made from the string by replacing all percent encoded sequences with the matching UTF-8 characters.
var smallestEncoding: String.Encoding
The smallest encoding to which the string can be converted without loss of information.
func appending<T>(T) -> String
Returns a new string created by appending the given string.
func appendingFormat<T>(T, any CVarArg...) -> String
Returns a string created by appending a string constructed from a given format string and the following arguments.
func cString(using: String.Encoding) -> [CChar]?
Returns a representation of the string as a C string using a given encoding.
func canBeConverted(to: String.Encoding) -> Bool
Returns a Boolean value that indicates whether the string can be converted to the specified encoding without loss of information.
func caseInsensitiveCompare<T>(T) -> ComparisonResult
Returns the result of invoking compare:options:
with NSCaseInsensitiveSearch
as the only option.
func commonPrefix<T>(with: T, options: String.CompareOptions) -> String
Returns a string containing characters this string and the given string have in common, starting from the beginning of each up to the first characters that aren’t equivalent.
func compare<T>(T, options: String.CompareOptions, range: Range<Self.Index>?, locale: Locale?) -> ComparisonResult
Compares the string using the specified options and returns the lexical ordering for the range.
func completePath(into: UnsafeMutablePointer<String>?, caseSensitive: Bool, matchesInto: UnsafeMutablePointer<[String]>?, filterTypes: [String]?) -> Int
Interprets the string as a path in the file system and attempts to perform filename completion, returning a numeric value that indicates whether a match was possible, and by reference the longest path that matches the string.
func components(separatedBy: CharacterSet) -> [String]
Returns an array containing substrings from the string that have been divided by characters in the given set.
func contains<T>(T) -> Bool
Returns true
iff other
is non-empty and contained within self
by case-sensitive, non-literal search.
func enumerateLines(invoking: @escaping (String, inout Bool) -> Void)
Enumerates all the lines in a string.
func enumerateSubstrings<R>(in: R, options: String.EnumerationOptions, @escaping (String?, Range<Self.Index>, Range<Self.Index>, inout Bool) -> Void)
Enumerates the substrings of the specified type in the specified range of the string.
func folding(options: String.CompareOptions, locale: Locale?) -> String
Returns a string with the given character folding options applied.
func getBytes<R>(inout [UInt8], maxLength: Int, usedLength: UnsafeMutablePointer<Int>, encoding: String.Encoding, options: String.EncodingConversionOptions, range: R, remaining: UnsafeMutablePointer<Range<Self.Index>>) -> Bool
Writes the given range
of characters into buffer
in a given encoding
, without any allocations. Does not NULL-terminate.
func getCString(inout [CChar], maxLength: Int, encoding: String.Encoding) -> Bool
Converts the String
’s content to a given encoding and stores them in a buffer.
func getLineStart<R>(UnsafeMutablePointer<Self.Index>, end: UnsafeMutablePointer<Self.Index>, contentsEnd: UnsafeMutablePointer<Self.Index>, for: R)
Returns by reference the beginning of the first line and the end of the last line touched by the given range.
func getParagraphStart<R>(UnsafeMutablePointer<Self.Index>, end: UnsafeMutablePointer<Self.Index>, contentsEnd: UnsafeMutablePointer<Self.Index>, for: R)
Returns by reference the beginning of the first paragraph and the end of the last paragraph touched by the given range.
func lengthOfBytes(using: String.Encoding) -> Int
Returns the number of bytes required to store the String
in a given encoding.
func localizedCaseInsensitiveCompare<T>(T) -> ComparisonResult
Compares the string and the given string using a case-insensitive, localized, comparison.
func localizedCaseInsensitiveContains<T>(T) -> Bool
Returns a Boolean value indicating whether the given string is non-empty and contained within this string by case-insensitive, non-literal search, taking into account the current locale.
func localizedCompare<T>(T) -> ComparisonResult
Compares the string and the given string using a localized comparison.
func localizedStandardCompare<T>(T) -> ComparisonResult
Compares the string and the given string as sorted by the Finder.
func localizedStandardContains<T>(T) -> Bool
Returns a Boolean value indicating whether the string contains the given string, taking the current locale into account.
func localizedStandardRange<T>(of: T) -> Range<Self.Index>?
Finds and returns the range of the first occurrence of a given string, taking the current locale into account. Returns nil
if the string was not found.
func maximumLengthOfBytes(using: String.Encoding) -> Int
Returns the maximum number of bytes needed to store the String
in a given encoding.
func padding<T>(toLength: Int, withPad: T, startingAt: Int) -> String
Returns a new string formed from the String
by either removing characters from the end, or by appending as many occurrences as necessary of a given pad string.
func range<T>(of: T, options: String.CompareOptions, range: Range<Self.Index>?, locale: Locale?) -> Range<Self.Index>?
Finds and returns the range of the first occurrence of a given string within a given range of the String
, subject to given options, using the specified locale, if any.
func rangeOfCharacter(from: CharacterSet, options: String.CompareOptions, range: Range<Self.Index>?) -> Range<Self.Index>?
Finds and returns the range in the String
of the first character from a given character set found in a given range with given options.
func rangeOfComposedCharacterSequence(at: Self.Index) -> Range<Self.Index>
Returns the range in the String
of the composed character sequence located at a given index.
func rangeOfComposedCharacterSequences<R>(for: R) -> Range<Self.Index>
Returns the range in the string of the composed character sequences for a given range.
func replacingCharacters<T, R>(in: R, with: T) -> String
Returns a new string in which the characters in a specified range of the String
are replaced by a given string.
func replacingOccurrences<Target, Replacement>(of: Target, with: Replacement, options: String.CompareOptions, range: Range<Self.Index>?) -> String
Returns a new string in which all occurrences of a target string in a specified range of the string are replaced by another given string.
func trimmingCharacters(in: CharacterSet) -> String
Returns a new string made by removing from both ends of the String
characters contained in a given character set.