escapeJava

open fun escapeJava(input: String): String(source)

Escapes the characters in a String using Java String rules.

Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.)

So a tab becomes the characters '\\' and 't'.

The only difference between Java strings and JavaScript strings is that in JavaScript, a single quote and forward-slash (/) are escaped.

Example:

input string: He didn't say, "Stop!"
output string: He didn't say, \"Stop!\"

Return

String with escaped values, null if null string input

Parameters

input

String to escape values in, may be null