以下示例展示了如何在 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!"); } }
对于C#中的转义序列的完整列表 −
转义字符 | 描述 | 模式 |
---|---|---|
\a | 匹配响铃字符,\u0007。 | \a |
\b | 在字符类中,匹配退格字符,\u0008。 | [\b]{3,} |
\t | 匹配制表符,\u0009。 | (\w+)\t |
\r | 匹配回车符,\u000D。(\r与换行符不等价, ) | \r (\w+) |
\v | 匹配垂直制表符,\u000B。 | [\v]{2,} |
\f | 匹配换页符,\u000C。 | [\f]{2,} |
匹配换行符,\u000A。 | \r (\w+) | |
\e | 匹配转义符,\u001B。 | \e |
以上就是C# 支持哪些转义序列?的详细内容,更多请关注php中文网其它相关文章!
已抢64993个
抢已抢27607个
抢已抢14982个
抢已抢7444个
抢已抢9397个
抢已抢19001个
抢