views:

1070

answers:

2

Given an NSArray of NSStrings, is there a quick way to join them together into a single NSString (with a Separator)?

+19  A: 
NSArray * stuff = /* ... */;
NSString * combinedStuff = [stuff componentsJoinedByString:@"separator"];

This is the inverse of -[NSString componentsSeparatedByString:].

Dave DeLong
+4  A: 

-componentsJoinedByString: on NSArray should do the trick.

BJ Homer