I was working on this:
NSString *str1 = @"This is string A";
NSString *str2 = @"This is string B";
NSComparisonResult compareResult;
if([str1 isEqualToString:str2] == YES)
NSLog (@"str1 == str2");
else
NSLog (@"str1 != str2");
compareResult = [str1 compare: str2];
if (compareResult == NSOrderedAscending)
NSLog (@"str1 < str2");
else if(compareResult == NSOrderedSame)
NSLog (@"str1 == str2");
else
NSLog (@"str1 > str2");
So my question is:
what is the difference between compare: and isEqualToString:
I am new to programming, so please bear with.
Thanks a lot.