NSComparisonResult

NSComparisonResult compareResult;

compareResult = [str1 compare:str2];

if (compareResult == NSOrderedAscending)
NSLog(@"str1 preceeds str2");
else if (compareResult == NSOrderedSame)
NSLog(@"str1 is the same as str2");
else // must be NSOrderedDescending
NSLog(@"str1 follows str2");
Previous
Next Post »