我已经编写了NSPredicate来过滤元素。
-(void)filterResult:(NSMutableArray*)array
{
search=TRUE;
filteredCategoryList=[[NSArray alloc]init];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"roles beginsWith %@ || UserResponseDetails IN %@ ",array,array];
filteredCategoryList = [MembersList filteredArrayUsingPredicate:predicate];
[filteredCategoryList retain];
}
问题是我在角色中得到了一个像"sample;Example“这样的字符串,而其他的则是单个字符串。如何编写谓词条件来获取Sample、Example、sample和Example的元素。。
发布于 2018-08-23 12:50:54
我得到了一个解决方案,我必须在谓词中使用“contains”关键字,而不是“beginswith”。
https://stackoverflow.com/questions/13931335
复制