def utf8.decode.go

cswap-bend-cli@0.1.0.0 · b64.bend:70

import cswap-bend-cli@0.1.0.0/b64.bend as B64
import Base

70# Decode UTF-8 bytes (lenient on malformed input).
71def utf8.decode.go(bs: List<&2, U32>, +need: U32, +cp: U32) -> String:
72  match bs:
73    case Nil{}:
74      SNil{}
75    case Con{+b, t}:
76      +cp2 = utf8.cp(b, need, cp)
77      utf8.put(utf8.emit(b, need), cp2, utf8.decode.go(t, utf8.need(b, need), cp2))

Uses (7)

Used by (1)