CFStringCompareWithOptionsAndLocale(_:_:_:_:_:)
Compares a range of the characters in one string with another string using a given locale.
Declaration
func CFStringCompareWithOptionsAndLocale(_ theString1: CFString!, _ theString2: CFString!, _ rangeToCompare: CFRange, _ compareOptions: CFStringCompareFlags, _ locale: CFLocale!) -> CFComparisonResultParameters
- theString1:
The first string to use in the comparison.
- theString2:
The second string to use in the comparison. The full range of this string is used.
- rangeToCompare:
The range of characters in
theString1to be used in the comparison totheString2. To use the whole string, pass the rangeCFRangeMake(0, CFStringGetLength(theString1)). The specified range must not exceed the bounds of the string. - compareOptions:
Flags that select different types of comparisons, such as case-insensitive comparison and non-literal comparison. See String Comparison Flags for the available flags.
Specifying the
kCFCompareBackwardsorkCFCompareAnchoredoption has no effect.Specifying the
kCFCompareLocalizedoption and passingNULLforlocalecauses the current locale (the return value of Cflocalecopycurrent()) to be used. - locale:
The locale to use for the comparison, which affects both equality and ordering algorithms. For example, in some locales, accented characters are ordered immediately after the base; other locales order them after “z”.
If
NULLand thekCFCompareLocalizedoption is not specified forcompareOptions, the comparison is nonlocalized.
Return Value
A CFComparisonResult value that indicates whether theString1 is equal to, less than, or greater than theString2.