Folds a given string into the form specified by optional flags.
SDKs
- iOS 2.0+
- macOS 10.5+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Core Foundation
Declaration
func CFStringFold(_ theString: CFMutable String!, _ theFlags: CFString Compare Flags, _ 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
k
removes case distinctions in accordance with the mapping specified by ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt. Folding withCFCompare Case Insensitive k
removes distinctions of accents and other diacritics. Folding withCFCompare Diacritic Insensitive k
removes character width distinctions by mapping characters in the rangeCFCompare Width Insensitive U+FF00-U+FFEF
to their ordinary equivalents.theLocale
The locale to use for the operation.
NULL
specifies the canonical locale (the return value fromCFLocale
).Get System() 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 CFString
in addition to CFStringFold in order to obtain the effect of k
.