RosettaCodeData/Task/URL-encoding/Sidef/url-encoding.sidef

8 lines
169 B
Text
Raw Permalink Normal View History

2016-12-05 23:44:36 +01:00
func urlencode(str) {
str.gsub!(%r"([^-A-Za-z0-9_.!~*'() ])", {|a| "%%%02X" % a.ord});
str.gsub!(' ', '+');
return str;
}
say urlencode('http://foo bar/');