URL encoding: Difference between revisions

Content deleted Content added
Blanvill (talk | contribs)
→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)"
Langurmonkey (talk | contribs)
Line 902: Line 902:
)
)


val .original = "https://some website.com/"
writeln .urlEncode("https://some website.com/")</syntaxhighlight>

writeln .original
writeln .urlEncode(.original)</syntaxhighlight>

This should work with non-ASCII characters as well (assuming that's valid).


We pass a custom anonymous function to replace(), which uses the the s2b() function (returning UTF-8 bytes from a string), and a for loop adding them all.
We pass a custom anonymous function to replace(), which uses the the s2b() function (returning UTF-8 bytes from a string), and a for loop adding them all.