split multimethod

Methods

split(e:Eachable1, delim:Any) Source: stdlib.ngs:2313
Split e into arrays

Returns

Arr of Arr

Example

[1, "a", 2, 3, "a", 4].split("a")  # [[1], [2, 3], [4]]
split(s:Str, delim:Str, max_parts:Int=0) Source: stdlib.ngs:3474
Split string by substring

Parameters

sString to split
delimDelimiter to split by
max_partsMaximum number of resulting parts, 0 - unlimited

Returns

Arr of Str

Example

":a:bc:d:".split(":")   # ["", "a", "bc", "d", ""]
"bucket_name/dir/file".split("/", 2)  # ["bucket_name", "dir/file"]
":a:bc:d:".split("bc")  # [":a:", ":d:"]
split(s:Str, r:RegExp) Source: stdlib.ngs:5858
Split string by regexp

Returns

Arr of Str

Example

"x10ab20c30y".split(/[0-9]+/).join(" :: ")  # "x :: ab :: c :: y"