标签:
//查找名字里面包含“王”的姓
NSArray *array = [[NSArray alloc]initWithObjects:@"小王",@"王力",@"李丽",@"方方", nil];
NSString *match = @"*王*";
//查找姓王的名字,王字必须为首字则修改NSString *match=@"王*";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF like %@", match];
NSArray *results = [array filteredArrayUsingPredicate:predicate];
for (id str in results) {
NSLog(@"%@",str);
}
标签:
原文地址:http://www.cnblogs.com/hz-1521049517/p/5120304.html