Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
24
Task/URL-encoding/Delphi/url-encoding.pas
Normal file
24
Task/URL-encoding/Delphi/url-encoding.pas
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
function EncodeURL(URL: string): string;
|
||||
var I: integer;
|
||||
begin
|
||||
Result:='';
|
||||
for I:=1 to Length(URL) do
|
||||
if URL[I] in ['0'..'9', 'A'..'Z', 'a'..'z'] then Result:=Result+URL[I]
|
||||
else Result:=Result+'%'+IntToHex(byte(URL[I]),2);
|
||||
end;
|
||||
|
||||
procedure EncodeAndShowURL(Memo: TMemo; URL: string);
|
||||
var ES: string;
|
||||
begin
|
||||
Memo.Lines.Add('Unencoded URL: '+URL);
|
||||
ES:=EncodeURL(URL);
|
||||
Memo.Lines.Add('Encoded URL: '+ES);
|
||||
Memo.Lines.Add('');
|
||||
end;
|
||||
|
||||
procedure ShowEncodedURLs(Memo: TMemo);
|
||||
begin
|
||||
EncodeAndShowURL(Memo,'http://foo bar/');
|
||||
EncodeAndShowURL(Memo,'https://rosettacode.org/wiki/URL_encoding');
|
||||
EncodeAndShowURL(Memo,'https://en.wikipedia.org/wiki/Pikes_Peak_granite');
|
||||
end;
|
||||
Loading…
Add table
Add a link
Reference in a new issue