Filtering Array content with Predicate
suggest changefilteredArrayUsingPredicate: evaluates a predicate against the array’s contents and returns the objects that match. (filterUsingPredicate: is the in-place variant on NSMutableArray.)
Example:
NSMutableArray *array = [NSMutableArray array];
[array setArray:@[@"iOS",@"macOS",@"tvOS"]];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF beginswith[c] 'i'"];
NSArray *resultArray = [array filteredArrayUsingPredicate:predicate];
NSLog(@"%@",resultArray);
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents