I use C#.
I need assign a value to a string as verbatim
.
Here my code:
string verbatim = "@<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">";
or
string verbatim = @"<META NAME=""ROBOTS"" CONTENT=""NOINDEX, NOFOLLOW"">";
But it does not work.
What I'm doing wrong here? Thanks
You mean a verbatim string literal? Double-up the internal quotes and move the @
:
string verbatim = @"<META NAME=""ROBOTS"" CONTENT=""NOINDEX, NOFOLLOW"">";
@ charctaer在字符串ath开头之外,你需要逃避你的报价,即
string verbatim = @"<META NAME=""ROBOTS"" CONTENT=""NOINDEX, NOFOLLOW"">"
@必须在字符串之外,你需要使用双引号:
string verbatim = @"<META NAME=""ROBOTS"" CONTENT=""NOINDEX, NOFOLLOW"">";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.