• 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: Best way to create string from an array of dictionaries?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best way to create string from an array of dictionaries?


  • Subject: Re: Best way to create string from an array of dictionaries?
  • From: Frédéric Testuz <email@hidden>
  • Date: Mon, 24 Jul 2006 16:17:52 +0200


Le 24 juil. 06 à 12:25, Keith Blount a écrit :

Hello,

In my app the user can create an array of keywords for
each document created and then search by these
keywords. The keywords are entered via a table view
with an NSArrayController, but the search relies on
searching strings. For the search, I therefore need to
convert the array of keywords into a plain string.

Obviously, NSArray has a great method for this:

-componentsJoinedByString:

However, each component of my -keywords array is an
NSDictionary. Each dictionary just contains a keyword
string for the key "keyword" - there are no other
keys. Really, it could be a straightforward array
holding the strings directly rather than dictionaries,
were it not for the fact that NSArrayController relies
on KVC, and thus the components of my array must be
dictionaries to work in my bound table view.

This don't work? [[keywords valueForKey:@"keyword"] componentsJoinedByString:@"/n"];

And I'm not sure, but for the KVC part, try using the key "self" in the NSArrayController with an array of string directly.

Frédéric _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Best way to create string from an array of dictionaries?
      • From: Keith Blount <email@hidden>
References: 
 >Best way to create string from an array of dictionaries? (From: Keith Blount <email@hidden>)

  • Prev by Date: Custom window with small stoplight
  • Next by Date: Core Data 4GB limit (SQLite backend)?
  • Previous by thread: Re: Best way to create string from an array of dictionaries?
  • Next by thread: Re: Best way to create string from an array of dictionaries?
  • Index(es):
    • Date
    • Thread