UrlEncode(text) Last updated: 18. Dec 2023
Converts a string into a URL-encoded format, replacing unsafe characters with a percent sign followed by two hexadecimal digits representing the character's ASCII code.
Parameters
Name | Type | Description |
---|---|---|
text | string | Text to encode. |
Returns
An encoded string.
Example
Code example (#JS)
#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.#{
var text = "1,2,3,4,5,6,7";
/* Split text by comma */
var array = docly.split(text, ",");
for(let item of array)
{
}#
<div>#item#</div>
#}#
Output
The #JS code above produces the output shown below:<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>