These values represent the options available to many of the string classes’ search and comparison methods.


typedef enum NSStringCompareOptions : NSUInteger {
} NSStringCompareOptions;


See Searching, Comparing, and Sorting Strings for details on the effects of these options.




A case-insensitive search.


Exact character-by-character equivalence.


Search from end of source string.


Search is limited to start (or end, if NSBackwardsSearch) of source string.


Numbers within strings are compared using numeric value, that is, Name2.txt < Name7.txt < Name25.txt.


Search ignores diacritic marks.


Search ignores width differences in characters that have full-width and half-width forms, as occurs in East Asian character sets.


Comparisons are forced to return either NSOrderedAscending or NSOrderedDescending if the strings are equivalent but not strictly equal.


The search string is treated as an ICU-compatible regular expression. If set, no other options can apply except NSCaseInsensitiveSearch and NSAnchoredSearch. You can use this option only with the rangeOfString:… methods and stringByReplacingOccurrencesOfString:withString:options:range:.

See Also

Identifying and Comparing Strings

- caseInsensitiveCompare:

Returns the result of invoking compare:options: with NSCaseInsensitiveSearch as the only option.

- localizedCaseInsensitiveCompare:

Compares the string with a given string using a case-insensitive, localized, comparison.

- compare:

Returns the result of invoking compare:options:range: with no options and the receiver’s full extent as the range.

- localizedCompare:

Compares the string and a given string using a localized comparison.

- compare:options:

Compares the string with the specified string using the given options.

- compare:options:range:

Returns the result of invoking compare:options:range:locale: with a nil locale.

- compare:options:range:locale:

Compares the string using the specified options and returns the lexical ordering for the range.

- localizedStandardCompare:

Compares strings as sorted by the Finder.

- hasPrefix:

Returns a Boolean value that indicates whether a given string matches the beginning characters of the receiver.

- hasSuffix:

Returns a Boolean value that indicates whether a given string matches the ending characters of the receiver.

- isEqualToString:

Returns a Boolean value that indicates whether a given string is equal to the receiver using a literal Unicode-based comparison.


An unsigned integer that can be used as a hash table address.


Options for converting string encodings.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software