def text.replace
import ezsys@0.1.0.0/src/str.bend as Strimport Base
127# every `old` replaced by `new`, left to right, never overlapping; an empty
128# `old` puts `new` before every character and at the end
129def text.replace(txt: String, +old: String, +new: String) -> String:
130 match old:
131 case SNil{}:
132 new ++ text.replace.gaps(txt, new)
133 case SCon{oh, ot}:
134 text.replace.go(txt, 0n, SCon{oh, ot}, new)