VB.NET, adding a double quote character to string

前端 未结 3 1885
名媛妹妹
名媛妹妹 2020-12-11 19:22

Everytime I add CharW(34) to a string it adds two \"\" symbols

Example:

text = \"Hello,\" + Char(34) + \"World\" + Char(34)         


        
3条回答
  •  粉色の甜心
    2020-12-11 19:50

    The text doesn't really have double quotes in it. The debugger is quoting the text so that it appears as it would in your source code. If you were to do this same thing in C#, embedded new lines are displayed using it's source code formatting.

    Instead of using the debugger's output, you can add a statement in your source to display the value in the debug window.

    Diagnostics.Debug.WriteLine(text)
    

    This should only show the single set of quotes.

提交回复
热议问题