on 492ae2f help sign in
51 lines 1.1 kB history raw
1### `++urle`
3Encode URL
5The inverse of [`++urld`](). Accepts a tape `tep` and replaces all
6characters other than alphanumerics and `.`, `-`, `~`, and `_`, with URL
7escape sequences.
9Accepts
10-------
12`tep` is a [`++tape`]().
14Produces
15--------
17A `++tape`.
19Source
20------
22 ++ urle :: URL encode
23 |= tep=tape
24 ^- tape
25 %- zing
26 %+ turn tep
27 |= tap=char
28 =+ xen=|=(tig=@ ?:((gte tig 10) (add tig 55) (add tig '0')))
29 ?: ?| &((gte tap 'a') (lte tap 'z'))
30 &((gte tap 'A') (lte tap 'Z'))
31 &((gte tap '0') (lte tap '9'))
32 =('.' tap)
33 =('-' tap)
34 =('~' tap)
35 =('_' tap)
36 ==
37 [tap ~]
38 ['%' (xen (rsh 0 4 tap)) (xen (end 0 4 tap)) ~]
39 ::
41Examples
42--------
44 ~zod/main=> (urle "hello")
45 "hello"
46 ~zod/main=> (urle "hello dear")
47 "hello%20dear"
48 ~zod/main=> (urle "hello-my?=me !")
49 "hello-my%3F%3Dme%20%20%21"