Friday, 18 August 2017
c# - Can I escape a double quote in a verbatim string literal?
Answer
Answer
In a verbatim string literal (@"foo") in C#, backslashes aren't treated as escapes, so doing \" to get a double quote doesn't work. Is there any way to get a double quote in a verbatim string literal?
This understandably doesn't work:
string foo = @"this \"word\" is escaped";
Answer
Use a duplicated double quote.
@"this ""word"" is escaped";
outputs:
this "word" is escaped
Subscribe to:
Post Comments (Atom)
casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV
In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...
-
I'm using Simple HTML DOM to extract data from a HTML document, and I have a couple of issues that I need some help with. On the line th...
-
I've just started to learn CodeIgniter and gotten trouble with example below: My Controller: class Site extends CI_Controller ...
-
I've got a just installed ubuntu 11.10. I follow the first answer in this question. I installed: freeglut3 freeglut3-dev igor@ubuntu:~$...
No comments:
Post a Comment