betaveros / noulith

*slaps roof of [programming language]* this bad boy can fit so much [syntax sugar] into it
1.13k stars 20 forks source link

splits #26

Closed crides closed 7 months ago

crides commented 7 months ago

split (with limit), rsplit and split_re, with limits.

noulith> "a b c d" split " "
\1: ["a", "b", "c", "d"]: list
noulith> "a b c d" split " " by 3
\2: ["a", "b", "c d"]: list
noulith> "a b c d" rsplit " "
\3: ["d", "c", "b", "a"]: list
noulith> "a b c d" rsplit " " by 3
\4: ["d", "c", "a b"]: list
noulith> "a   b    c" split_re R"\s+"
\5: ["a", "b", "c"]: list
noulith> "a   b    c" split_re R"\s+" by 2
\7: ["a", "b    c"]: list