locked
What character escape sequences are available in C#?

    Question

  • What character escape sequences are available in C#?


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, April 09, 2009 7:15 AM

Answers

  • C# defines the following character escape sequences:

    • \' - single quote, needed for character literals
    • \" - double quote, needed for string literals
    • \\ - backslash
    • \0Null
    • \a - Alert
    • \b - Backspace
    • \f - Form feed
    • \n - New line
    • \r - Carriage return
    • \t - Horizontal tab
    • \v - Vertical quote
    • \u - Unicode escape sequence for character

    ·     \U - Unicode escape sequence for surrogate pairs.

    • \x - Unicode escape sequence similar to "\u" except with variable length.

     

    For more FAQ about Visual C# General, please see Visual C# General FAQ

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

    Thursday, April 09, 2009 7:16 AM