NSArray 过滤
// 数据源 NSArray *dataArr = [NSArray arrayWithObjects:@"a1", @"abc1", @"abc4", @"abc2", nil]; // 过滤对象 // NSArray *filterArr = [NSArray arrayWithObjects:@"abc1", @"abc2", nil]; NSString *filterStr = @"abc1"; // 过滤器 // NSPredicate *thePredicate = [NSPredicate predicateWithFormat:@"NOT (SELF in %@)", filterArr]; NSPredicate *thePredicate = [NSPredicate predicateWithFormat:@"NOT (SELF in %@)", filterStr]; // 过滤后的新数组 NSArray *resultArr = [[NSArray alloc]initWithArray:[dataArr filteredArrayUsingPredicate:thePredicate]]; NSLog(@"过滤后的结果:%@",resultArr);