Escape sequence for strings

string type supports all escape sequence from char type.

CharMeaningValue
\'Single quote0x0027
\"Double quote0x0022
\\Backslash0x005C
\0Null0x0000
\aAlert0x0007
\bBackspace0x0008
\fForm feed0x000C
\nNew line0x000A
\rCarriage return0x000D
\tHorizontal tab0x0009
\vVertical tab0x000B

The following example shows how to create a path string in C#.


using System;

class Program
{
    static void Main(string[] args)
    {
        string path = "c:\\a\\c\\d.exe";
        Console.WriteLine(path);

    }
}

The output:


c:\a\c\d.exe
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.