To insert characters that are illegal in a string, use an escape character.An escape character is a backslash \ followed by the character you want to insert.An example of an illegal character is a double quote inside a string that is surrounded by double quotes:...
\\BackslashTry it » \nNew LineTry it » \rCarriage ReturnTry it » \tTabTry it » \bBackspaceTry it » \fForm Feed \oooOctal valueTry it » \xhhHex valueTry it » Track your progress - it's free! Log inSign Up...
The sequence \" inserts a double quote in a string:ExampleGet your own C# Server string txt = "We are the so-called \"Vikings\" from the north."; Try it Yourself » The sequence \' inserts a single quote in a string:Example string txt = "It\'s alright."; Try it Yourself ...
The sequence \' inserts a single quote in a string:Example string txt = "It\'s alright."; Try it Yourself » The sequence \\ inserts a single backslash in a string:Example string txt = "The character \\ is called backslash."; Try it Yourself » ...