开发者

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:""

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜