2012年2月10日 星期五

[iOS Dev] NSArray字串合併成NSString - How to join NSArray elements into an NSString?

Code:
NSArray *args = [[NSArray alloc] initWithObjects:@"Apple", @"iOS", @"5.1", nil];
NSLog(@"%@", [args componentsJoinedByString:@" "]);

Result:
Apple iOS 5.1

Reference: http://stackoverflow.com/questions/1387440/how-to-join-nsarray-elements-into-an-nsstring
Related Posts Plugin for WordPress, Blogger...