Jhorra Jhorra - 2 years ago 137
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:@","];

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download