kwigbo

Adventures in iOS!

1 note

Check if NSString Contains a Sub String

This is a simple category that allows you to see if an instance of NSString contains a specific sub string.

@interface NSString (SubString)
- (BOOL) hasSubString:(NSString *) str;
@end
 
@implementation NSString (SubString)
- (BOOL) hasSubString:(NSString *) str
{
	return [self rangeOfString:str].location != NSNotFound;
}
@end

Filed under snippet

  1. kwigbo posted this