Function escapeValue

Escapes string by replacing special symbols with escaped sequences. These symbols are: '\\' (backslash), '\n' (newline), '\r' (carriage return) and '\t' (tab).

String escapeValue(String) (
  String value
) pure @trusted
if (isSomeString!String && is(ElementEncodingType!String : char));

Returns

Escaped string.

See Also

unescapeValue

Example

assert("a\\next\nline\top".escapeValue() == `a\\next\nline\top`); // notice how the string on the right is raw.
assert("a\\next\nline\top".dup.escapeValue() == `a\\next\nline\top`.dup);