Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
What are the escape sequences supported by C#?
The following is an example showing how to display some of the escape characters in C# −
Example
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!\nThis is on the next line!");
}
}
For the complete list of escape sequences in C# −
| Escape character | Description | Pattern |
|---|---|---|
| \a | Matches a bell character, \u0007. | \a |
| \b | In a character class, matches a backspace, \u0008. | [\b]{3,} |
| \t | Matches a tab, \u0009. | (\w+)\t |
| \r | Matches a carriage return, \u000D. (\r is not equivalent to the newline character, .) |
\r (\w+) |
| \v | Matches a vertical tab, \u000B. | [\v]{2,} |
| \f | Matches a form feed, \u000C. | [\f]{2,} |
| Matches a new line, \u000A. | \r (\w+) |
|
| \e | Matches an escape, \u001B. | \e |
Advertisements
