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");
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");
Sign up here with your email
ConversionConversion EmoticonEmoticon