Home  >  Article  >  Backend Development  >  What escape sequences does C# support?

What escape sequences does C# support?

PHPz
PHPzforward
2023-09-04 16:53:02914browse

C# 支持哪些转义序列?

The following example shows how to display some 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# −

##match newline character,\u000A . \rmatch escape character,\u001B . \e
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,}

(\w )

\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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete
Previous article:Rewritten in C#Next article:Rewritten in C#