Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/URL-decoding/XPL0/url-decoding.xpl0
Normal file
23
Task/URL-decoding/XPL0/url-decoding.xpl0
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
code Text=12;
|
||||
string 0; \use zero-terminated strings
|
||||
|
||||
func Decode(S0); \Decode URL string and return its address
|
||||
char S0;
|
||||
char S1(80); \BEWARE: very temporary string space returned
|
||||
int C, N, I, J;
|
||||
[I:= 0; J:= 0;
|
||||
repeat C:= S0(I); I:= I+1; \get char
|
||||
if C=^% then \convert hex to char
|
||||
[C:= S0(I); I:= I+1;
|
||||
if C>=^a then C:= C & ~$20; \convert to uppercase
|
||||
N:= C - (if C<=^9 then ^0 else ^A-10);
|
||||
C:= S0(I); I:= I+1;
|
||||
if C>=^a then C:= C & ~$20;
|
||||
C:= N*16 + C - (if C<=^9 then ^0 else ^A-10);
|
||||
];
|
||||
S1(J):= C; J:= J+1; \put char in output string
|
||||
until C=0;
|
||||
return S1;
|
||||
];
|
||||
|
||||
Text(0, Decode("http%3A%2F%2Ffoo%20bar%2f"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue