NSPredicate Demo

import

int main(int argc, const char * argv[]) {
@autoreleasepool {

    NSMutableArray *array =[NSMutableArray arrayWithObjects:@"Bill",@"Ben",@"Chris",@"Melissa",nil];
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF beginswith[c] 'C'"];
    //SELF contains[c] 'C'
    
    NSArray *arrayB = [array filteredArrayUsingPredicate:predicate];
    
    //NSLog(@"%ud",[arrayB count]);
    
    for (int i=0;i

}

你可能感兴趣的:(NSPredicate Demo)