If I have an NSSet
of NSString
objects, how can I join them together to create a single NSString
?
How do I join an NSSet's elements to create an NSString?
Asked Answered
NSSet
's -allObjects
method will return an NSArray
of objects in the receiver.
So, knowing this, it's pretty simple:
[[set allObjects] componentsJoinedByString:@" "];
However, be aware that "The order of the objects in the array isn’t defined." –
Harken
© 2022 - 2024 — McMap. All rights reserved.