Swift Split String to an Array
To split a string to an array in Swift by a character, use the String.split(separator:) function. For example, let’s split a string by commas: Output: However, this requires that the separator is a singular character, not a string. To split a string to an array by a separator string, use String.components(separatedBy:) function. For example, let’s […]
Swift Split String to an Array Read More »