if NSString does not equal function?

2020-07-09 06:27发布

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'.

2条回答
2楼-- · 2020-07-09 06:48
 if(![myNSString isEqualToString:@"text"])
查看更多
爷、活的狠高调
3楼-- · 2020-07-09 07:06

For case insensitive compare we can handle by:

 if( [@"Some String" caseInsensitiveCompare:@"some string"] == NSOrderedSame ) {
      // strings are equal except for possibly case
    }
查看更多
登录 后发表回答