compare:
Returns the result of invoking
compare:options:range: with no options and the receiver’s full extent as the range.
- (NSComparisonResult)compare:(NSString *)aString
Parameters
- aString
- The string with which to compare the receiver.This value must not be
nil. If this value isnil, the behavior is undefined and may change in future versions of OS X.
Return Value of [NSString compare]
The result of invoking
compare:options:range: with no options and the receiver’s full extent as the range.Discussion of [NSString compare]
If you are comparing strings to present to the end-user, you should typically use
localizedCompare: orlocalizedCaseInsensitiveCompare: instead.
Example of [NSString compare]
if([txtAnswer.text compare:answer options:NSCaseInsensitiveSearch] == NSOrderedSame)
{
// Do somehing
}
Example of [NSString compare]
NSComparisonResult result = [selectedString compare:searchText options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch) range:NSMakeRange(0, [searchText length])];