• 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: easy way to store table-like data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: easy way to store table-like data


  • Subject: Re: easy way to store table-like data
  • From: Matt Neuburg <email@hidden>
  • Date: Tue, 08 Mar 2011 08:13:29 -0800

On Mon, 07 Mar 2011 12:29:27 -0800, Dave DeLong <email@hidden> said:
>If you have an array of dictionaries, you can use -filteredArrayUsingPredicate, and pass in the NSPredicate with the format string of @"type = 'website'".  You'll get back all the dictionaries where [[dictionary objectForKey:@"type"] isEqual:@"website"];
>
>On Mar 7, 2011, at 12:26 PM, Martin Batholdy wrote:
>
>> Is it also possible to filter the entries of an NSDictionary like in SQL?
>>
>> for example I have a key "type" and different entries.
>>
>> Is it possible to get an Array of all elements where "type" is equal to "website" (or something like that)?

I am surprised that no one has mentioned blocks. For example, if you restrict yourself to Mac OS X 10.6 or later, or iOS 4 or later, you can call keysOfEntriesPassingTest:, and similarly for arrays. Your best bet is to look over the documentation (e.g., if you want to know what you can do with an NSDictionary, read the class reference for NSDictionary; if you want to know what you can do with an NSArray, read up on NSArray; etc.).

However, I'd also point out that you may be combining two or three different issues in the way your original question is posed. How your data are stored is one thing (could be sqlite; on the other extreme, could be simple tab-delimited text). How they are manipulated is another (could be NSDictionary, NSArray, etc., or, as Dave DeLong rightly suggests, a class devoted to data structured a particular way). How they are presented in the interface is yet another. m.

--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________

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

  • Prev by Date: Re: Notifications and Subclassing
  • Next by Date: NSXMLParserDelegateAbortedParseError
  • Previous by thread: Re: easy way to store table-like data
  • Next by thread: NSMapTable options
  • Index(es):
    • Date
    • Thread