Jhorra Jhorra - 1 year ago 113
Swift Question

Objective-C Simplest way to create comma separated string from an array of objects

So I have a nsmutablearray with a bunch of objects in it. I want to create a comma separated string of the id value of each object.

Answer Source

Use the NSArray instance method componentsJoinedByString:.

- (NSString *)componentsJoinedByString:(NSString *)separator.


NSString *joinedComponents = [array componentsJoinedByString:@","];