Re: Best way to create string from an array of dictionaries?
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