问题
I have searched all over the place for this, including apple's docs on NSString (maybe I didn't see?) but I am trying to find a method in xCode for checking wether a NSString does not equal to something. Much like
if (myNSSting = @"text" {...
except specifically I want to check if it does not equal to 'text'.
回答1:
if(![myNSString isEqualToString:@"text"])
回答2:
For case insensitive compare we can handle by:
if( [@"Some String" caseInsensitiveCompare:@"some string"] == NSOrderedSame ) {
// strings are equal except for possibly case
}
来源:https://stackoverflow.com/questions/15375815/if-nsstring-does-not-equal-function