I have a dictionary of arrays which I want to filter based on an element in the arrays. My dictionary looks like this...
"Abu Dhabi, U.A.E." = ( "24.466665", "54.416668", "Asia/Dubai" ); "Accra, Ghana" = ( "5.583333", "-0.100000", "Africa/Accra" ); "Adak, America" = ( "", "", "America/Adak" ); "Addis Ababa, Ethiopia" = ( "9.050000", "38.700001", "Africa/Addis_Ababa" );
I want to filter the dictionary based on the 3rd item, for example all keys that the third item (timezone ID) is "America/Adak".
I think I can do this with keysOfEntriesPassingTest, but I am at a loss as to how to do this. I have found some sample code...
mySet = [myDict keysOfEntriesPassingTest:^(id key, id obj, BOOL *stop) {
if( [[obj port] isEqual: [NSNumber numberWithInt: 8080]]) {
return YES;
else
return NO;
}]
But I cannot figure out how to rewrite this to work in my case. I do not understand the syntax required.
Could someone please help me figure out how to implement this filter?
Thanks, John