Skip to content

script.escapeControlCharacters ​

Replaces control characters in a string, such as newlines and tabs, with Unicode escape sequences. For example, a newline becomes \u000a. Use it to keep text on one line, such as in a log entry. To reverse it, use script.unescapeControlCharacters.

js
script.escapeControlCharacters(input)

Parameters ​

ParameterTypeDescription
inputstringThe string to escape.

Returns ​

string

The string with its control characters escaped.

Examples ​

js
const escaped = script.escapeControlCharacters("Line one\nLine two");
text
Line one\u000aLine two