ios - How to compare two case insensitive strings? -


i have 2 string objects containing same string case different,now wanna compare them ignoring case sensitivity,how that??here code...

#import <foundation/foundation.h> void main()   {       nsstring *mystring1 = @"mphasis";       nsstring *mystring2 = @"mphasis";     if ([mystring1 caseinsenstivecompare:mystring2])       {           nslog (@"its equal");       }       else       {            nslog (@"its not equal");       }   }   

if caseinsensitivecompare: in docs you'll see returns nscomparisonresult rather bool. in docs , you'll see want nsorderedsame.

if ([mystring1 caseinsensitivecompare:mystring2] == nsorderedsame)

should trick. or compare lowercase strings robert suggested.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -