السبت، 29 أكتوبر 2016

Escape characters in Java

JavaScript uses the \ (backslash) as an escape character for:
  • \' single quote
  • \" double quote
  • \\ backslash
  • \n new line
  • \r carriage return
  • \t tab
  • \b backspace
  • \f form feed
  • \v vertical tab (IE < 9 treats '\v' as 'v' instead of a vertical tab ('\x0B'). If cross-browser compatibility is a concern, use \x0B instead of \v.)
  • \0 null character (U+0000 NULL) (only if the next character is not a decimal digit; else it is an octal escape sequence)
Note that the \v and \0 escapes are not allowed in JSON strings.