Instance Method

componentsJoinedByString:

Constructs and returns an NSString object that is the result of interposing a given separator between the elements of the array.

Declaration

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

Parameters

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.

See Also

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software