I am having an NSMutableArray as my original array and I want to filter it out with its keyvalue pair but only certain keyvalue pair as shown in example.
I don’t want to use looping logic. Is there any other way to get the required output?
I don’t want to modify my original array.
original array{
"name" = "name";
"end_date" = "test end date";
"id" = 104;
"start_date" = "test start date";
"user_id" = 5;
},
{
"name" = "name1";
"end_date" = "test1 end date";
"id" = 105;
"start_date" = "test1 start date";
"user_id" = 5;
}
want filtered array as
{
"name" = "name";
"end_date" = "test end date";
"start_date" = "test start date";
}
}
"name" = "name";
"end_date" = "test end date";
"start_date" = "test start date";
}
How Can I achieve this without using for loop?
You can use enumerateObjectsUsingBlock using something like this (I didn’t enumerate all the keys from the NSDictionary:
If you wanted just a subset of the elements, you could use an NSPredicate.