escapeValue

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

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

Return Value

Type: String

Escaped string.

Examples

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);

See Also

Meta