Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/URL-encoding/Yabasic/url-encoding.basic
Normal file
17
Task/URL-encoding/Yabasic/url-encoding.basic
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
sub encode_url$(s$, exclusions$, spaceplus)
|
||||
local res$, i, ch$
|
||||
|
||||
for i=1 to len(s$)
|
||||
ch$ = mid$(s$, i, 1)
|
||||
if ch$ = " " and spaceplus then
|
||||
ch$ = "+"
|
||||
elsif not instr(esclusions$, ch$) and (ch$ < "0" or (ch$ > "9" and ch$ < "A") or (ch$ > "Z" and ch$ < "a") or ch$ > "z") then
|
||||
res$ = res$ + "%"
|
||||
ch$ = upper$(hex$(asc(ch$)))
|
||||
end if
|
||||
res$ = res$ + ch$
|
||||
next i
|
||||
return res$
|
||||
end sub
|
||||
|
||||
print encode_url$("http://foo bar/")
|
||||
Loading…
Add table
Add a link
Reference in a new issue