.split(separator:)
Splits the text into parts.
Syntax
text.split(separator: ",")
Description
Splits the text by the given separator and returns an array of Substrings. count gives the number of parts, [0] gets the first part.
Example
Loading editor…
Expected output
3 a
When to use?
CSV parsing, splitting a sentence into words.