def take_sp.go

bend-kit-http@0.38.2.0 · http.bend:209

import bend-kit-http@0.38.2.0/http.bend as Http
import Base

209# hit: the last char pushed onto acc was the stop char.
210def take_sp.go(s: String, acc: String, hit: Bool) -> String & String:
211  match s:
212    case SNil{}:
213      match hit:
214        case True{}:
215          take.cut(acc, SNil{})
216        case False{}:
217          (String.reverse(acc), SNil{})
218    case SCon{Chr{+c}, t}:
219      match hit:
220        case True{}:
221          take.cut(acc, SCon{Chr{c}, t})
222        case False{}:
223          take_sp.go(t, SCon{Chr{c}, acc}, U32.is_eq(c, 32))

Uses (8)

Used by (1)