def octs.take
import emerging-ezhttp@0.21.0.0/src/http.bend as Httpimport Base
165# the front of a string that is this many bytes of UTF-8
166def octs.take(s: String, +n: Nat) -> String:
167 match s:
168 case SNil{}:
169 SNil{}
170 case SCon{+h, t}:
171 +w = octs.width(Char.to_u32(h))
172 octs.take.step(Nat.is_lt(n, w), h, _u => octs.take(t, Nat.sub(n, w)))