[英]Escape codes for control characters in C# string
可用的轉義符號列表是此列表,來自哪些字符轉義序列可用? (作者:喬恩·斯基特) :
\' – 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)
如果您所需的代碼不能直接用作簡單的轉義代碼,則可以使用十六進制轉義。 例如,對於您來說, \\x0E
表示14或\\x15
表示21。 正如Jon Skeet的評論中所述:最好使用Unicode版本,即\
和\
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.