join() The join() method creates and returns a new string by concatenating all of the elements in an array (or an array-like object), separated by commas or a specified separator string. If the array has only one item, then that item will be returned without using the separator.
A static, plain-text Unicode string object that bridges to String ; use NSString when you need reference semantics or other Foundation-specific behavior.
There are many ways to do it, the simplest being
[yourArray componentsJoinedByString: @","]
Use NSArray's componentsJoinedByString:
method.
NSArray *strings = ...;
NSString *combined = [strings componentsJoinedByString:@","];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With