if NSString does not equal function?

让人想犯罪 __ 提交于 2019-12-09 16:38:57

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!