get a dictionary out of an array of dictionaries by a criterion

2011-03-09 Thread Martin Batholdy
Hi,

I have a plist with an array of dictionaries.
Now every of these dictionaries has a key 'ID' with an integer.

Now how I can get only one dictionary element out of this array where key is 
equal to x?


thanks for any advice!

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: get a dictionary out of an array of dictionaries by a criterion

2011-03-09 Thread Dave DeLong
Load the array into memory.
Create an NSPredicate with the predicateFormat: @ID = %d, myID
Use filteredArrayUsingPredicate:
The resulting array contains the dictionaries you're looking for.

OR

Loop through the array and find it yourself.

Dave

On Mar 9, 2011, at 9:18 AM, Martin Batholdy wrote:

 Hi,
 
 I have a plist with an array of dictionaries.
 Now every of these dictionaries has a key 'ID' with an integer.
 
 Now how I can get only one dictionary element out of this array where key is 
 equal to x?
 
 
 thanks for any advice!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com