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
I hope this helps you,.. add this line at .m file or create a separate class and integrate this code.
@implementation NSString (Contains)
- (BOOL) containsString: (NSString*) substring
{
NSRange range = [self rangeOfString : substring];
BOOL found = ( range.location != NSNotFound );
return found;
}
@end