RosettaCodeData/Task/URL-encoding/EasyLang/url-encoding.easy

22 lines
396 B
Plaintext

func$ tohex h .
for c in [ h div 16 h mod 16 ]
c += 48
if c >= 58 : c += 7
r$ &= strchar c
.
return r$
.
func$ urlenc s$ .
for c$ in strchars s$
c = strcode c$
if c >= 48 and c <= 57 or c >= 65 and c <= 90 or c >= 97 and c <= 122
#
else
c$ = "%" & tohex c
.
r$ &= c$
.
return r$
.
print urlenc "http://foo bar/"