C# two double quotes

前端 未结 11 1512
灰色年华
灰色年华 2020-12-10 03:54

I want to print two double quotes in C# as the output. How to do this?

I mean the output should be: \"\" Hello World \"\"

11条回答
  •  离开以前
    2020-12-10 04:33

    If you want to put double quotes in a string you need to escape them with a \

    eg:

    string foo = "here is a \"quote\" character";
    

    If you want to literally output "" Hello World "" then you'd need:

    string helloWorld = "\"\" Hello World \"\"";
    output(helloWorld);
    

    (where output is whatever method you are using for output)

提交回复
热议问题