Objective-C Language Searching for a Substring


Example

To search if a String contains a substring, do the following:

NSString *myString = @"This is for checking substrings";
NSString *subString = @"checking"; 

BOOL doesContainSubstring = [myString containsString:subString];  // YES

If targeting iOS 7 or OS X 10.9 (or earlier):

BOOL doesContainSubstring = ([myString rangeOfString:subString].location != NSNotFound);  // YES