Function

CFStringCompareWithOptions

Compares a range of the characters in one string with that of another string.

Declaration

CFComparisonResult CFStringCompareWithOptions(CFStringRef theString1, CFStringRef theString2, CFRange rangeToCompare, CFStringCompareFlags compareOptions);

Parameters

theString1

The first string to use in the comparison.

theString2

The second string to use in the comparison.

rangeToCompare

The range of characters in theString1 to be used in the comparison to theString2. To use the whole string, pass the range CFRangeMake(0, CFStringGetLength(theString1)) or use CFStringCompare. The specified range must not exceed the length of the string.

compareOptions

Flags that select different types of comparisons, such as localized comparison, case-insensitive comparison, and non-literal comparison. If you want the default comparison behavior, pass 0. See String Comparison Flags for the available flags.

Return Value

A CFComparisonResult value that indicates whether theString1 is equal to, less than, or greater than theString2.

Discussion

You can affect how the comparison proceeds by specifying one or more option flags in compareOptions.

If you want to compare one entire string with another string, use the CFStringCompare function.

See Also

Comparing Strings

CFStringCompare

Compares one string with another string.

CFStringCompareWithOptionsAndLocale

Compares a range of the characters in one string with another string using a given locale.

CFStringHasPrefix

Determines if the character data of a string begin with a specified sequence of characters.

CFStringHasSuffix

Determines if a string ends with a specified sequence of characters.