5

I want to find the codes for the below control characters used in Microsoft Word.

enter image description here

I have found some of them. Please correct me if I am wrong. I have browsed the web for them. But I was unable to find some of the codes.

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
ApsSanj
  • 549
  • 7
  • 23
  • 3
    https://stackoverflow.com/questions/3414900/how-to-get-a-char-from-an-ascii-character-code-in-c-sharp – mjwills Jul 29 '19 at 11:11
  • 1
    Some of them just don't have escaped codes. You'll have to create a `char` with their numeric value – Biesi Jul 29 '19 at 11:11
  • If they all have an ASCII code this thread might help you. https://stackoverflow.com/questions/3414900/how-to-get-a-char-from-an-ascii-character-code-in-c-sharp – Raziel Jul 29 '19 at 11:15
  • https://devblogs.microsoft.com/csharpfaq/what-character-escape-sequences-are-available/ might help too. – AKX Jul 29 '19 at 11:22

1 Answers1

8

The list of available escape symbols is this one, from What character escape sequences are available? (by Jon Skeet):

\' – 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)

If the one you need isn't directly available as a simple escape code, you can use the hexadecimal escape. In your case, for example, \x0E for 14 or \x15 for 21. As stated in Jon Skeet's comment: it's better to use the Unicode version, i.e. \u000e and \u0015.

Bryan Menard
  • 13,234
  • 4
  • 31
  • 47
JotaBe
  • 38,030
  • 8
  • 98
  • 117
  • 3
    I'd personally recommend avoiding using `\x` as it's variable-length in a very confusing way. I'd suggest `\u000e` and `\u0015`. – Jon Skeet Jul 29 '19 at 11:58