def text.split.go
import ezsys@0.1.0.0/src/str.bend as Strimport Base
159# the scan for a nonempty separator; `skip` characters of a found separator
160# are still to pass over
161def text.split.go(txt: String, skip: Nat, +sep: String) -> List<&2, String>:
162 match txt skip:
163 case SNil{} _:
164 [SNil{}]
165 case SCon{_h, t} 1n+k:
166 text.split.go(t, k, sep)
167 case SCon{+h, +t} 0n:
168 text.split.at(String.starts_with(SCon{h, t}, sep), h,
169 text.after(sep),
170 k => text.split.go(t, k, sep))