我正在尝试匹配下面的字符串,但不幸的是它只给了我“不”的结果。任何人都可以帮忙吗?提前致谢!
NSMutableAttributedString *text = [NSMutableString stringWithString:@"darn thing suddenly erupted without any warning.";
NSString *findMe = @"suddenly erupted";
[text enumerateSubstringsInRange:NSMakeRange(0, [text length]) options:NSStringEnumerationByWords usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
if ([findMe isEqualToString:substring] ) {
NSLog(@"found it");
}
else {
NSLog(@"nope");
}
}];