My question is similar to How do I check if a string contains another string in Objective-C?
How can I check if a string (NSString) contains another smaller string but w
You can use -(NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask;
to get a range for a substring, the mask
parameter is used to specify case insensitive match.
Example :
NSRange r = [str rangeOfString:@"BLA"
options:NSCaseInsensitiveSearch];
As stated in the documentation, the method returns a range like {NSNotFound, 0}
when the substring isn't found.
BOOL b = r.location == NSNotFound;
Important this method raises an exception if the string is nil
.