componentsJoined(by:)
Constructs and returns an NSString object that is the result of interposing a given separator between the elements of the array.
Declaration
func componentsJoined(by separator: String) -> StringParameters
- separator:
The string to interpose between the elements of the array.
Return Value
An NSString object that is the result of interposing separator between the elements of the array. If the array has no elements, returns an NSString object representing an empty string.
Discussion
For example, this code excerpt writes “here be dragons” to the console:
NSArray *pathArray = [NSArray arrayWithObjects:@"here", @"be", @"dragons", nil];
NSLog(@"%@",[pathArray componentsJoinedByString:@" "]);Special Considerations
Each element in the array must handle description.