What are all the escape characters?

后端 未结 4 1027
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 05:18

I know some of the escape characters in Java, e.g.

\\n : Newline
\\r : Carriage return
\\t : Tab
\\\\ : Backslash
...

Is there a complete l

相关标签:
4条回答
  • 2020-11-22 06:08

    Yes, below is a link of docs.Oracle where you can find complete list of escape characters in Java.

    Escape characters are always preceded with "\" and used to perform some specific task like go to next line etc.

    For more Details on Escape Character Refer following link:

    https://docs.oracle.com/javase/tutorial/java/data/characters.html

    0 讨论(0)
  • 2020-11-22 06:09
    Java Escape Sequences:
    
    \u{0000-FFFF}  /* Unicode [Basic Multilingual Plane only, see below] hex value 
                      does not handle unicode values higher than 0xFFFF (65535),
                      the high surrogate has to be separate: \uD852\uDF62
                      Four hex characters only (no variable width) */
    \b             /* \u0008: backspace (BS) */
    \t             /* \u0009: horizontal tab (HT) */
    \n             /* \u000a: linefeed (LF) */
    \f             /* \u000c: form feed (FF) */
    \r             /* \u000d: carriage return (CR) */
    \"             /* \u0022: double quote (") */
    \'             /* \u0027: single quote (') */
    \\             /* \u005c: backslash (\) */
    \{0-377}       /* \u0000 to \u00ff: from octal value 
                      1 to 3 octal digits (variable width) */
    

    The Basic Multilingual Plane is the unicode values from 0x0000 - 0xFFFF (0 - 65535). Additional planes can only be specified in Java by multiple characters: the egyptian heiroglyph A054 (laying down dude) is U+1303F / 𓀿 and would have to be broken into "\uD80C\uDC3F" (UTF-16) for Java strings. Some other languages support higher planes with "\U0001303F".

    0 讨论(0)
  • 2020-11-22 06:13

    These are escape characters which are used to manipulate string.

    \t  Insert a tab in the text at this point.
    \b  Insert a backspace in the text at this point.
    \n  Insert a newline in the text at this point.
    \r  Insert a carriage return in the text at this point.
    \f  Insert a form feed in the text at this point.
    \'  Insert a single quote character in the text at this point.
    \"  Insert a double quote character in the text at this point.
    \\  Insert a backslash character in the text at this point.
    

    Read more about them from here.

    http://docs.oracle.com/javase/tutorial/java/data/characters.html

    0 讨论(0)
  • 2020-11-22 06:16

    You can find the full list here.

    • \t Insert a tab in the text at this point.
    • \b Insert a backspace in the text at this point.
    • \n Insert a newline in the text at this point.
    • \r Insert a carriage return in the text at this point.
    • \f Insert a formfeed in the text at this point.
    • \' Insert a single quote character in the text at this point.
    • \" Insert a double quote character in the text at this point.
    • \\ Insert a backslash character in the text at this point.
    0 讨论(0)
提交回复
热议问题