1
我有包含国家列表。如从NSMutableArray搜索NSString并在UiTableView中添加
countries_list = [NSMutableArray arrayWithObjects:@"Afghanistan",@"Albania",
@"Bolivia",@"Bulgaria",@"China", @"Estonia",@"France",@"Finland",
@"Greenland",@"Iceland",@"Japan", nil];
从这个数组,我需要为阿尔巴尼亚排序列表中的所有国家都与该字母开头的排序铝等开始,然后,然后我必须在UITableView中添加这些值搜查。 我只需要搜索帮助我,如果有人可以。感谢
NSMutableArray* containsAnother = [NSMutableArray array];
NSMutableArray* doesntAnother = [NSMutableArray array];
for (NSString* item in inputArray)
{
if ([item rangeOfString:@"Finland"].location != NSNotFound){
[containsAnother addObject:item];
NSLog(@"country is found..%@",containsAnother);
}else{
}
[doesntContainAnother addObject:item];
NSLog(@"country is not found..%@",doesntContainAnother);
}
NSLog(@"array is found..%@",containsAnother);
您期待什么类型的搜索? –