Skip to content

Section documentation for STACK-Maxima /strings/escapes


str_to_html(string_to_escape)

A function to convert a string to an escaped HTML/XML string.

Do note that this is not idempotent, and will escape the escaped things if the original already uses entities.

Argument name type description
string_to_escape string the string to be escaped.
Return type description
string a string with all characters sensitive in HTML/XML turned to entities.

str_to_html_char(c)

A function to convert singular characters to HTML/XML-entities if necessary.

To convert longer strings use str_to_html.

Argument name type description
c string a single character string.
Return type description
string a string with characters sensitive in HTML/XML turned to entities.

str_to_js(string_to_escape)

A function to convert a string to an escaped ECMAScript string.

Do note that this is not idempotent, and will escape the escaped things if the original already uses did so.

Argument name type description
string_to_escape string the string to be escaped.
Return type description
string a string with characters sensitive in ECMAScript escaped.

str_to_js_char(c)

A function to convert singular characters to ECMAScript escaped chars if necessary.

To convert longer strings use str_to_js.

Argument name type description
c string a single character string.
Return type description
string a string with characters sensitive in ECMAScript escaped.