escape sequences

 

  Escape sequences work for both String and char.  Escape sequences appear in single quotes for a char, in double quotes for a String.  i.e.

 

char c = ‘\b’; 

String s = “\u00c1”;

 

  The compiler doesn’t check inside a String escape sequence after the first 4 digits.  i.e.

 

String s = “\u0000foobah”;  works and ignores the foobah part

 

  Here are the legal escape sequences:

 

    \b           backspace

    \t            tab

    \n           new line feed

    \f            form feed

    \r            carriage return

    \”           double quote mark

    \’            single quote mark

    \\            backslash

    \xxx         octal character in range 000-377.  Higher than 377 won’t compile. Illegal digits like 8’s or 9's or A's won’t compile.

    \uxxxx  hex full 16-bit character