[small feature] Add \e string escape sequence #7394
Replies: 2 comments 9 replies
-
I'd champion a proposal here. Having done the raw-strings-work, i know this would be a trivial thing to implement on compiler and IDE side. |
Beta Was this translation helpful? Give feedback.
9 replies
-
Closing in favor of #7400. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
We currently have the following escape sequences in C# strings:
\'
- 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 tab (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)However, as I am working very often with VT100/ANSI escape codes, I do miss a short escape sequence for the character
0x1b
, which is needed all the time in ANSI escape sequences.Currently, I often write myself writing stuff like:
Actual Feature Request
I know that it only saves a couple of characters, but I'd really love to see
\e
as a shorthand for\u001b
as a new escape sequence for C# strings, in order to enhance readability in the context of VT100/ANSI escape codes:Implementation Cost
Hopefully, it should be low, as the internal translation would be identical to how e.g.
\n
gets translated to\u000a
.Alternatives
Alternatively, one can always use the following:
or:
Beta Was this translation helpful? Give feedback.
All reactions