RosettaCodeData/Task/URL-encoding/EasyLang/url-encoding.easy
2025-02-27 18:35:13 -05:00

21 lines
396 B
Text

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/"