I’m compairing two strings. There are equal. isEqualToString: returns NSOrderedDescending.
I thought isEqualToString: would return NSOrderedSame. Can someone explain to me why this happens?
example case…
NSString *myString = @"1";
if ( [myString isEqualToString:@"1"] == NSOrderedSame ) {
// is NSOrderedSame
}
Since writing the question I know I should use instead compare:. It will return NSOrderedSame. But I would like to know, still, why this happens.
Thanks
Ross
It doesn’t return
NSOrderedDescending, it returnsYES. Check the return type of that method!NSOrderedDescendingis anNSComparisonResult, and happens to have a value of1due to its declaration:Don’t mix and match types!