//查找字符串是否包含“心”
NSString *str = @"每天都有好心情";
if ([str containsString:@"心"]) {
NSLog(@"字符串包含“心”");
//containString适用于ios8系统,在ios7系统下会崩溃
}
NSRange range = [str rangeOfString:@"心"];
if (range.location != NSNotFound) {//有@“心”
//ios7系统下也适用
NSLog(@"字符串包含“心”");
}