def octs.has

emerging-ezhttp@0.21.0.0 · src/http.bend:237

import emerging-ezhttp@0.21.0.0/src/http.bend as Http
import Base

237# whether a string is at least this many bytes of UTF-8, walking no further
238# than that many (octs.len walks all of it)
239def octs.has(s: String, +n: Nat) -> Bool:
240  match s:
241    case SNil{}:
242      Bool.not(Nat.is_lt(0n, n))
243    case SCon{+h, t}:
244      +w = octs.width(Char.to_u32(h))
245      octs.has.step(Nat.is_lt(n, w), _u => octs.has(t, Nat.sub(n, w)))

Uses (9)

Used by (2)