Java - .Net Escape / Unescape

Escapes or unescapes a Java or .Net string removing traces of offending characters that could prevent compiling.

The following characters are reserved in Java and .Net and must be properly escaped to be used within strings:

  • Backspace is replaced with \b
  • Newline is replaced with \n
  • Tab is replaced with \t
  • Carriage return is replaced with \r
  • Form feed is replaced with \f
  • Double quote is replaced with \"
  • Backslash is replaced with \\