New in Formulas 2.0
The split()
function separates the first argument into a list, using the second argument to define the separation.
split(string, string) split(string) string.split(string) string.split()
Note that if the second argument is not supplied, the string will be split at the space character.
split("One Two Three") /* Output: ["One", "Two", "Three"] */
Good to know: numbers can be used in the first and second arguments, but both the arguments and the resulting list items will be converted into strings. For example, split(13214215, 2)
will return ["13", "14", "15"]
If you needed to convert those strings back into numbers, you would need to use the map
function and its current
variable → split(13214215, 2).map(toNumber(current))
will return [13, 14, 15]
Example Formulas
split("Luffy, Zoro, Nami, Chopper", ", ")
/* Output: ["Luffy", "Zoro", "Nami", "Chopper"] */
"https://thomasjfrank.com/formulas/functions/split".split("/")
/* Output: ["thomasjfrank.com", "formulas", "functions", "split"] */