string_split(s, @optional delim = \space, include_empty = false)
Split the string
s and return the parts as a list of strings.
Delim should be a character, a list of characters or a predicate that accepts a
character as its sole argument.
delim is a character,
s is split at each position where
delim is a list of characters,
s is split at each position where one of those
delim is a function, it is called with each character in
s as argument.
true for a character,
s is split at that point and that part is
added to the result list.
true, empty parts are also included in the result.
let s = "hello, world" string_split(s) // [hello,, world] string_split(s, \,) // [hello, world] string_split(s, ^(c) char_is_eq(c, \l)) // [he, o wor, d] s = "1;2.3,4.5;6" string_split(s, [\;, \., \,]) // [1, 2, 3, 4, 5, 6] string_split(s, [\;, \,]) // [1, 2.3, 4.5, 6]
Core Module Index | Contents