split
lib callCapy
function split(value : string, delimiter : string) any
Description
split separates text at each exact delimiter. The delimiter can contain several bytes. The result keeps empty fields before, between, and after delimiters. For example, split(",a,,", ",") has four items.
An empty input produces one empty item. An empty delimiter returns the whole input as one item. It does not split characters. Use split_utf8 for UTF-8 characters.
The result is an any list, not a typed [string] array. Use join, numeric indexing, or for value, key := parts to read it. The loop key has type string.
Return Values
List-shaped any.
Example
Capy
print(join(split("one,two", ","), "|"), "\n")
Output
one|two