Returns an array containing substrings from the receiver that have been divided by a given separator.
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
The separator string.
NSArray object containing substrings from the receiver that have been divided by
The substrings in the array appear in the order they did in the receiver. Adjacent occurrences of the separator string produce empty strings in the result. Similarly, if the string begins or ends with the separator, the first or last substring, respectively, is empty. For example, this code fragment:
produces the array
@[@"Karin", @"Carrie", @"David"].
list begins with a comma and space—for example,
@", Norman, Stanley, Fletcher"—the array has these contents:
@[@"", @"Norman", @"Stanley", @"Fletcher"].
list has no separators—for example,
@"Karin"—the array contains the string itself, in this case