I have an NSArray called myArray
. I want to filter myArray
objects so, that I exclude all elements from this array corresponding to the keywords from another array keywords
.
So, that's my pseudocode:
keywords = @[@"one", @"three"];
myArray = @[@"textzero", @"textone", @"texttwo", @"textthree", @"textfour"];
predicate = [NSPredicate predicateWithFormat:@"NOT (SELF CONTAINS_ANY_OF[cd] %@), keywords];
myArray = [myArray filteredArrayUsingPredicate:predicate];
And that's what I want to get by NSLog(@"%@", myArray)
>> ("textzero", "texttwo", "textfour")
How should I do it?