How to make a variable that holds double qoutes
The question is simple, How do I define a variable which holds double quotes. when I try to define the variable like this
Dim s as S开发者_C百科tring = " " "
,
VS puts an extra quote like this
Dim s as String = """"
The extra "
is used to escape the "
character, so the sequence of two double-quotes (""
) will show up as "
when your string is displayed.
You actually have it correct with the 4 quotes, that is VBs way of escaping the quotes. So, for example:
Dim oneDoubleQuote As String = """"
Dim twoDoubleQuotes As String = """"""
MessageBox.Show("One:" & oneDoubleQuote)
MessageBox.Show("Two:" & twoDoubleQuotes)
The first message box has One:" and the second has Two:""
精彩评论