Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/URL-decoding/Free-Pascal/url-decoding.pas
Normal file
26
Task/URL-decoding/Free-Pascal/url-decoding.pas
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
function urlDecode(data: String): AnsiString;
|
||||
var
|
||||
ch: Char;
|
||||
pos, skip: Integer;
|
||||
|
||||
begin
|
||||
pos := 0;
|
||||
skip := 0;
|
||||
Result := '';
|
||||
|
||||
for ch in data do begin
|
||||
if skip = 0 then begin
|
||||
if (ch = '%') and (pos < data.length -2) then begin
|
||||
skip := 2;
|
||||
Result := Result + AnsiChar(Hex2Dec('$' + data[pos+2] + data[pos+3]));
|
||||
|
||||
end else begin
|
||||
Result := Result + ch;
|
||||
end;
|
||||
|
||||
end else begin
|
||||
skip := skip - 1;
|
||||
end;
|
||||
pos := pos +1;
|
||||
end;
|
||||
end;
|
||||
Loading…
Add table
Add a link
Reference in a new issue