search substring from mutable array in iphone

Posted by user566431 on Stack Overflow See other posts from Stack Overflow or by user566431
Published on 2011-01-07T06:26:12Z Indexed on 2011/01/07 6:53 UTC
Read the original article Hit count: 148

Filed under:
|

how to search substring from mutable array?

NSMutableArrray names having string values,

searchText is a substring to search from name array values.

for (NSString *sTemp in names)
    {
        NSRange titleResultsRange = [sTemp rangeOfString:searchText options:NSCaseInsensitiveSearch];
        //NSLog(@"sTemp = %@, searchText = %@",sTemp,searchText);
        NSLog(@"%@",titleResultsRange.length);
        if (titleResultsRange.length > 0)
            [Items addObject:sTemp];
    }

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c