• 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: Newbie Q
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie Q


  • Subject: Re: Newbie Q
  • From: Kiel Gillard <email@hidden>
  • Date: Sat, 17 Sep 2005 20:18:32 +1000

Hi Aaron,

Check out NSArray's componentsJoinedByString instance method.

For example:
NSArray * words = [NSArray arrayWithObjects:@"Aaron", "Wallis", nil];
NSString * concatenation = [words componentsJoinedByString:@" "];

You could pass [NSString string] or @"" to the componentsJoinedByString: method if you don't want the descriptions of each object in the array to be seperated by a string.

As the documentation for this method says, each element of the receiver must respond to the description method. You could override this method to produce the results you might be looking for.

Hope this helps,

Kiel :-)
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity."
Albert Einstein
_______________________________________________
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
  • Prev by Date: Re: Universal Binary and Backwards compatability
  • Next by Date: Re: Printing sample code?
  • Previous by thread: Re: Newbie Q
  • Next by thread: Find the height of the toolbar?
  • Index(es):
    • Date
    • Thread