Use option NSCaseInsensitiveSearchwithrangeOfString:options:
NSString *me = @"toBe" ;
NSString *target = @"abcdetobe" ;
NSRange range = [target rangeOfString: me options: NSCaseInsensitiveSearch];
NSLog(@"found: %@", (range.location != NSNotFound) ? @"Yes" : @"No");
if (range.location != NSNotFound) {
}
NSLog Output:
found: yes
Note. I changed the goal to demonstrate that case insensitive search works.
"or'ed" :
- NSCaseInsensitiveSearch
- NSLiteralSearch
- NSBackwardsSearch
- NSAnchoredSearch
- NSNumericSearch
- NSDiacriticInsensitiveSearch
- NSWidthInsensitiveSearch
- NSForcedOrderingSearch
- NSRegularExpressionSearch