June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
9
Task/URL-decoding/Perl-6/url-decoding.pl6
Normal file
9
Task/URL-decoding/Perl-6/url-decoding.pl6
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
my $url = "http%3A%2F%2Ffoo%20bar%2F";
|
||||
|
||||
say $url.subst: :g,
|
||||
/'%'(<:hexdigit>**2)/,
|
||||
-> ($ord ) { chr(:16(~$ord)) }
|
||||
|
||||
# Alternately, you can use an in-place substitution:
|
||||
$url ~~ s:g[ '%' (<:hexdigit> ** 2) ] = chr :16(~$0);
|
||||
say $url;
|
||||
Loading…
Add table
Add a link
Reference in a new issue