URL decoding: Difference between revisions

 
(3 intermediate revisions by 2 users not shown)
Line 944:
 
=={{header|langur}}==
<syntaxhighlight lang="langur">val .finish = f(.s) b2s map f number(.x, 16), rest split "%", .s
val finish = fn s:b2s(map(fn x:number(x, 16), rest(split("%", s))))
val .decode = f(.fn s) :replace .(s, re/(%[0-9A-Fa-f]{2})+/, .finish)
 
writeln .decode("http%3A%2F%2Ffoo%20bar%2F")
writeln .decode("google.com/search?q=%60Abdu%27l-Bah%C3%A1")
</syntaxhighlight>
 
Line 1,303 ⟶ 1,304:
mailto:"Irma User" <irma.user@mail.com>
</pre>
 
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
uses System;
 
function URLDecode(s: string) := Uri.UnescapeDataString(s);
begin
Println(URLDecode('http%3A%2F%2Ffoo%20bar%2F'));
Println(URLDecode('google.com/search?q=%60Abdu%27l-Bah%C3%A1'));
Println(URLDecode('%25%32%35'));
end.
</syntaxhighlight>
{{out}}
<pre>
http://foo bar/
google.com/search?q=`Abdu'l-Bahá
%25
</pre>
 
 
=={{header|Perl}}==
1,007

edits