I have a large number of strings that I\'m searching to see if a given substring exists. It seems there are two reasonable ways to do this.
Option 1: Use the NSStr
Case (n): If you are having array of strings to test for a sub string, it will be better to use NSPredicate.
NSPredicate *regex = [NSPredicate predicateWithFormat:@"SELF CONTAINS %@", substring];
NSArray *resultArray = [originalArrayOfStrings filteredArrayUsingPredicate:regex];
This will return array of strings which contain the sub string.
If you useNSRange, in this case, you need to loop through all the string objects of the array manually, and obviously it will be slower than NSPredicate.