How can I detect if a string contains a certain word? For example, I have a string below which reads:
@\"Here is my string.\"
I\'d like to know
Use the following code to scan the word in sentence.
NSString *sentence = @"The quick brown fox"; NSString *word = @"quack"; if ([sentence rangeOfString:word].location != NSNotFound) { NSLog(@"Yes it does contain that word"); }