URL decoding: Difference between revisions

m
→‎{{header|Perl 6}}: Combine blocks to make runnable code for ease of automated testing
m (→‎{{header|Perl 6}}: Combine blocks to make runnable code for ease of automated testing)
Line 932:
say $url.subst: :g,
/'%'(<:hexdigit>**2)/,
-> ($ord ) { chr(:16(~$ord)) }</lang>
 
# Alternately, you can use an in-place substitution:
<lang perl6>$url ~~ s:g[ '%' (<:hexdigit> ** 2) ] = chr :16(~$0);
say $url;</lang>
 
10,343

edits