1、筛选纯字符串数组的内容
NSArray *array = [[NSArray alloc]initWithObjects:@"beijing",@"shanghai",@"guangzou",@"wuhan", nil]; NSString *string = @"ang"; NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF CONTAINS %@",string]; NSLog(@"%@",[array filteredArrayUsingPredicate:pred]);
输出结果是:
( shanghai, guangzou )
参考地址:http://blog.csdn.net/ztp800201/article/details/8116081
时间: 2024-11-05 14:52:57