C# 字符串中控制字符的转义码

Aps*_*anj 3 c# ms-word control-characters

我想找到 Microsoft Word 中使用的以下控制字符的代码。

在此处输入图片说明

我找到了其中的一些。如果我错了,请纠正我。我已经为他们浏览了网络。但我无法找到一些代码。

Jot*_*aBe 6

可用的转义符号列表是这个,来自哪些字符转义序列可用?(由乔恩斯基特)

\' – single quote, needed for character literals
\" – double quote, needed for string literals
\\ – backslash
\0 – Unicode character 0
\a – Alert (character 7)
\b – Backspace (character 8)
\f – Form feed (character 12)
\n – New line (character 10)
\r – Carriage return (character 13)
\t – Horizontal tab (character 9)
\v – Vertical quote (character 11)
\uxxxx – Unicode escape sequence for character with hex value xxxx
\xn[n][n][n] – Unicode escape sequence for character with hex value nnnn (variable length version of \uxxxx)
\Uxxxxxxxx – Unicode escape sequence for character with hex value xxxxxxxx (for generating surrogates)
Run Code Online (Sandbox Code Playgroud)

如果您需要的转义码不能直接用作简单的转义码,则可以使用十六进制转义码。例如,在您的情况下,对于\x0E14 或\x1521。如 Jon Skeet 的评论中所述:最好使用 Unicode 版本,即\u000e\u0015

  • 我个人建议避免使用“\x”,因为它的长度可变,非常令人困惑。我建议使用“\u000e”和“\u0015”。 (3认同)