开发者

How to use double quotes in a string when using the @ symbol?

I need to use double quotes in a string that uses 开发者_运维问答the @ symbol. Using double quotes is breaking the string. I tried escaping with \, but that doesn't work. Ideas?

How to use double quotes in a string when using the @ symbol?


I believe this should work:

string myString = @"Here is my ""quoted"" text.";


You double the quotes inside a verbatim string to get a quote character.

This makes your given sample:

(@"PREFIX rdfs: <" + rdfs + @">
      SELECT ?s ?p ?o
        WHERE { ?s ?p rdfs:Literal }
              {?s rdfs:label ""date""}");


You can use this if you want to write into a file :

string myString = @"Here is my ""quoted""text.";
myString.Replace(@"""",@"&quot;");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜