• 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
More on dictionaries
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

More on dictionaries


  • Subject: More on dictionaries
  • From: April Gendill <email@hidden>
  • Date: Tue, 14 Oct 2003 23:52:15 -0700

I have a dictionary structure that is basically built from a directory structure. I need to be able to search this dictionary as deep as it goes (files are strings and directories are nested dictionaries in this structure)
here's what information I have when I begin the search:
I know the root dictionary. Since the dictionary is a representation of a directory structure you could think of it as /root/item/....
I know the key name for the item that must be move/deleted
It's pretty easy to find the item. I run a loop.
in the loop I have:
if([theDictionary objectForKey:theSearchItem]){
do something then leave the loop
}
The problem is the do something. I have to be able to remove the object from the dictionary and I have no idea how. since the item to remove can be many parent/children deep I don't know how to remove it from the master dictionary..

I know that I'll need to return an id since I could either be dealing with a string or dictionary.
I've been trying to pass it as [self removeObject:theObject fromDict:masterDict]
the function is written as: -(id)removeObject:(id)theObject fromDict:(NSMutableDictionary *)theDict

I used a mutable dictionary so I could edit it as I went, but thats the problem... I'm not sure how to remove the item when I find it and then put the master dictionary back together correctly.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: More on dictionaries
      • From: Dustin Voss <email@hidden>
    • Re: More on dictionaries
      • From: "Sailesh Agrawal" <email@hidden>
  • Prev by Date: (no subject)
  • Next by Date: apps compiled with Apr 2002 dev tools not running on 10.3
  • Previous by thread: Re: Newbie NSView question.
  • Next by thread: Re: More on dictionaries
  • Index(es):
    • Date
    • Thread