Ví dụ hiển thị các ký tự thoát trong C#:
Ví dụ
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!");
}
}
Danh sách đầy đủ escape sequences:
| Ký tự thoát | Mô tả | Mẫu |
|---|---|---|
| \a | Chuông, \u0007. | \a |
| \b | Backspace trong lớp ký tự, \u0008. | [\b]{3,} |
| \t | Tab, \u0009. | (\w+)\t |
| \r | Carriage return, \u000D. (Khác \n). | \r\n(\w+) |
| \v | Vertical tab, \u000B. | [\v]{2,} |
| \f | Form feed, \u000C. | [\f]{2,} |
| \n | New line, \u000A. | \r\n(\w+) |
| \e | Escape, \u001B. | \e |