• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: looking for reference to a dictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: looking for reference to a dictionary


  • Subject: Re: looking for reference to a dictionary
  • From: Alex Heinz <email@hidden>
  • Date: Tue, 21 Oct 2008 12:16:36 -0400

You can't. Iterating through the array is the only way, unless the dictionaries are organized in some special way. Out of curiosity, why not just use a single dictionary, instead of an array of dictionaries?

HTH,
Alex

On Oct 21, 2008, at 12:08 PM, Stefan Wolfrum wrote:

Hi all,

I have an array. Each array entry is a dictionary. Each dictionary has two key/value pairs (all are strings).

Now I get from somewhere else the value (a string) corresponding to one of the keys. It's exactly the same string, content-wise (not address-wise).
What I need: a reference/pointer to THAT dictionary inside the array which contains this string as the value of the key (I know what key it is).


How would I do that?

My knowledge is: to get an array's entry I just have the objectAtIndex: method. But then I'd need the index where the dictionary I'm looking for is. How would I get the index without, of course, iterating through all the array's entries and looking at every dictionary and comparing my given value with all the values inside the dictionaries?

Thanks a LOT guys!!
Stefan.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >looking for reference to a dictionary (From: Stefan Wolfrum <email@hidden>)

  • Prev by Date: looking for reference to a dictionary
  • Next by Date: Re: looking for reference to a dictionary
  • Previous by thread: looking for reference to a dictionary
  • Next by thread: Re: looking for reference to a dictionary
  • Index(es):
    • Date
    • Thread