NSString *str1 = @"comeontom哈哈回复好 sad 分身乏术的发烧发烧的"; NSString *str2 = @"comeontom"; if ([str1 rangeOfString:str2].location != NSNotFound) { NSLog(@"str1包含str2"); }else{ NSLog(@"str1不包含str2"); }
判断一个字符串里是否包含了另一个字符串,布布扣,bubuko.com
原文地址:http://blog.csdn.net/nagecomeontom/article/details/32331099