split(separator:maxSplits:omittingEmptySubsequences:)

Returns the longest possible subsequences of the collection, in order, around elements equal to the given separator.

iOS
16.0+
macOS
13.0+
tvOS
16.0+
watchOS
9.0+
func split(separator: some RegexComponent, maxSplits: Int = .max, omittingEmptySubsequences: Bool = true) -> [Self.SubSequence]

Parameters

separator

A regex describing elements to be split upon.

Returns

A collection of substrings, split from this collection’s elements.