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 if I can detect a word in the string, such as, "is" for example.
THank you in advance
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 if I can detect a word in the string, such as, "is" for example.
THank you in advance
Here's how I would do it:
NSString *someString = @"Here is my string";
NSRange range = [someString rangeOfString:@" is " options:NSCaseInsensitiveSearch];
if( range.location != NSNotFound ) {
//found it...
}