Splits a string into substrings.
split(x:string, pattern:string, [max=int], [reverse=bool], [ignore_case=bool]) -> listDescription
Section titled “Description”The split function splits the input string x into a list of substrings
using the specified pattern. Optional arguments allow limiting the number
of splits (max), reversing the splitting direction (reverse), and
matching the literal delimiter case-insensitively (ignore_case).
x: string
Section titled “x: string”The string to split.
pattern: string
Section titled “pattern: string”The delimiter or pattern used for splitting.
max: int (optional)
Section titled “max: int (optional)”The maximum number of splits to perform.
Defaults to 0, meaning no limit.
reverse: bool (optional)
Section titled “reverse: bool (optional)”If true, splits from the end of the string.
Defaults to false.
ignore_case: bool (optional)
Section titled “ignore_case: bool (optional)”If true, matches the literal pattern using full Unicode case folding.
Defaults to false.
Examples
Section titled “Examples”Split a string by a delimiter
Section titled “Split a string by a delimiter”from {xs: split("a,b,c", ",")}{xs: ["a", "b", "c"]}Limit the number of splits
Section titled “Limit the number of splits”from {xs: split("a-b-c", "-", max=1)}{xs: ["a", "b-c"]}Split case-insensitively
Section titled “Split case-insensitively”from { ascii: split("/API/v1/Users", "api", ignore_case=true), unicode: split("Fußstraße", "STRASSE", ignore_case=true),}{ ascii: ["/", "/v1/Users"], unicode: ["Fuß", ""],}