The following example shows how to display some escape characters in C# -
using System; using System.Collections.Generic; class Demo { static void Main() { Console.WriteLine("Warning!" + '\u0007'); Console.WriteLine("Test \t Demo Text"); Console.WriteLine("This is it!This is on the next line!"); } }
For the complete list of escape sequences in C# −
Escape character | Description | Pattern |
---|---|---|
\a | Matches the bell character, \u0007. | \a |
\b | In character class, matches the backspace character, \u0008. | [\b]{3,} |
\t | matches tab character, \u0009. | (\w )\t |
\r | matches the carriage return character, \u000D. (\r is not equivalent to newline character, ) |
\r (\w ) |
\v | matches the vertical tab character, \u000B. | [\v]{2,} |
\f | matches the form feed character, \u000C. | [\f]{2,} |
##match newline character,\u000A . | \r | (\w ) |
\e | match escape character,\u001B .\e |
The above is the detailed content of What escape sequences does C# support?. For more information, please follow other related articles on the PHP Chinese website!