HtmlEncode(text) Last updated: 13. Nov 2023

Converts a string into an HTML-encoded string.

Parameters

Name Type Description
text string The string to encode

Returns

String

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#{
    let myString = "<a></a>";

    // Encode the string.
    let  myEncodedString = docly.HtmlEncode(myString);

    write(`HTML Encoded string is: ${myEncodedString}`);
}#

Output

The #JS code above produces the output shown below:
HTML Encoded string is: &lt;a&gt;&lt;/a&gt;