Gre*_*rds 1 arrays iphone search ios
我正在尝试在NSMutableArray中搜索字符串.我正在使用containsObject:当前但看起来这是区分大小写的.我需要搜索给定字符串的所有组合(trip).任何想法将不胜感激.
if ([self.theArray containsObject:trip]) {
Run Code Online (Sandbox Code Playgroud)
}
Jan*_*ann 10
不那么难:
BOOL found = NO;
for (NSString* str in self.theArray) {
if ([str caseInsensitiveCompare:trip] == NSOrderedSame) {
found = YES;
break;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2220 次 |
| 最近记录: |