Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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!
This 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