def Utf8.size

bend-kube-runtime@0.2.0.0 · src/utf8.bend:175

import bend-kube-runtime@0.2.0.0/src/utf8.bend as Utf8
import Base

175# The UTF-8 length of a string, in bytes.
176def Utf8.size(s: String) -> U32:
177  match s:
178    case SNil{}:
179      0
180    case SCon{Chr{+c}, t}:
181      (Utf8.size.of(c, U32.is_lt(c, 128), U32.is_lt(c, 2048), U32.is_lt(c, 65536))
182        + Utf8.size(t) : U32)

Uses (6)

Used by (2)