NSString indexOf in Objective-C

Total Post:23


 2397  View(s)
Rate this:

Are there anything similar to an indexOf function in the NSString objects?

  1. Re: NSString indexOf in Objective-C

    If you want just know when String a contains String b use my way to do this.
    #define contains(str1, str2) ([str1 rangeOfString: str2 ].location != NSNotFound)

    NSString a = @"PUC MINAS - BRAZIL";

    NSString b = @"BRAZIL";

    if( contains(a,b) ){
        //TO DO HERE


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.