on 492ae2f help sign in
38 lines 435 B history raw
1### `++teff`
3UTF8 Length
5Produces the number of utf8 bytes.
7Accepts
8-------
10`a` is a `@t`.
12Produces
13--------
15An atom.
17Source
18------
20 |= a/@t ^- @
21 =+ b=(end 3 1 a)
22 ~| %bad-utf8
23 ?: =(0 b)
24 ?>(=(`@`0 a) 0)
25 ?> |((gte b 32) =(10 b))
26 ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
28Examples
29--------
31 /~zod/try=> (teff 'a')
32 1
33 /~zod/try=> (teff 'ß')
34 2
38***