on 492ae2f help sign in
48 lines 989 B history raw
1### `++urld`
3Decode URL
5The inverse of [`++urle`](). Parses a URL escaped [`++tape`]() to the
6[`++unit`]() of an unescaped `++tape`.
8Accepts
9-------
11`tep` is a `++tape`.
13Produces
14--------
16The [`++unit`]() of a `++tape`.
18Source
19------
21 ++ urld :: URL decode
22 |= tep=tape
23 ^- (unit tape)
24 ?~ tep [~ ~]
25 ?: =('%' i.tep)
26 ?. ?=([@ @ *] t.tep) ~
27 =+ nag=(mix i.t.tep (lsh 3 1 i.t.t.tep))
28 =+ val=(rush nag hex:ag)
29 ?~ val ~
30 =+ nex=$(tep t.t.t.tep)
31 ?~(nex ~ [~ [`@`u.val u.nex]])
32 =+ nex=$(tep t.tep)
33 ?~(nex ~ [~ i.tep u.nex])
34 ::
36Examples
37--------
39 ~zod/main=> (urld "hello")
40 [~ "hello"]
41 ~zod/main=> (urld "hello%20dear")
42 [~ "hello dear"]
43 ~zod/main=> (urld "hello-my%3F%3Dme%20%20%21")
44 [~ "hello-my?=me !"]
45 ~zod/main=> (urld "hello-my%3F%3Dme%20%2%21")
46 ~