CFStringFold(_:_:_:)
Folds a given string into the form specified by optional flags.
Declaration
func CFStringFold(_ theString: CFMutableString!, _ theFlags: CFStringCompareFlags, _ theLocale: CFLocale!)Parameters
- theString:
The string which is to be folded. If this parameter is not a valid mutable CFString, the behavior is undefined.
- theFlags:
The equivalency flags which describes the character folding form. See “String Comparison Flags” in Cfstring for possible values. Only those flags containing the word “insensitive” are recognized; other flags are ignored.
Folding with
kCFCompareCaseInsensitiveremoves case distinctions in accordance with the mapping specified byftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt. Folding withkCFCompareDiacriticInsensitiveremoves distinctions of accents and other diacritics. Folding withkCFCompareWidthInsensitiveremoves character width distinctions by mapping characters in the rangeU+FF00-U+FFEFto their ordinary equivalents. - theLocale:
The locale to use for the operation.
NULLspecifies the canonical locale (the return value from Cflocalegetsystem()).The locale argument affects the case mapping algorithm. For example, for the Turkish locale, case-insensitive compare matches “I” to “ı” (Unicode code point U+0131, Latin Small Dotless I), not the normal “i” character.
Discussion
Character foldings are operations that convert any of a set of characters sharing similar semantics into a single representative from that set.
You can use this function to preprocess strings that are to be compared, searched, or indexed. Note that folding does not include normalization, so you must use CFStringNormalize(_:_:) in addition to CFStringFold in order to obtain the effect of kCFCompareNonliteral.
See Also
CFMutableString Miscellaneous Functions
CFStringAppend(_:_:)CFStringAppendCharacters(_:_:_:)CFStringAppendCString(_:_:_:)CFStringAppendFormatAndArguments(_:_:_:_:)CFStringAppendPascalString(_:_:_:)CFStringCapitalize(_:_:)CFStringCreateMutable(_:_:)CFStringCreateMutableCopy(_:_:_:)CFStringCreateMutableWithExternalCharactersNoCopy(_:_:_:_:_:)CFStringDelete(_:_:)CFStringFindAndReplace(_:_:_:_:_:)CFStringInsert(_:_:_:)CFStringLowercase(_:_:)CFStringNormalize(_:_:)CFStringPad(_:_:_:_:)