Reputation: 8722
I am converting some old carbon code to Cocoa and need to use a comparison function that will return the same result as the one in carbon.
I am calling:
CFStringCompare( stringA, stringB, kCFCompareCaseInsensitive | kCFCompareDiacriticInsensitive | kCFCompareNumerically );
Now, if stringA & stringB were NSString's and I wanted to compare them using a NSString method, which one, with what options (if any), would return the same result as the CFStringCompare function above?
Upvotes: 0
Views: 926
Reputation: 8722
The answer appears to be:
NSStringCompareOptions compareOptions = NSCaseInsensitiveSearch | NSNumericSearch | NSDiacriticInsensitiveSearch;
result = [stringA compare:stringB options:compareOptions];
Upvotes: 3
Reputation: 6991
[string1 isEqualToString:string2];
[string1 caseSensitiveCompare:string2];
and so on.
goto the NSString class reference for more information
Upvotes: -1