VB字符串如何加如引号啊,我用\转意字符好象不起作用
下面的代码,想在test两端加引号Dim str as stringstr = "hello \"test\" world"
msgbox(str)

解决方案 »

  1.   

    连续两个双引号表示一个双引号,连续两个单引号表示是个单引号
    str = "hello ""test"" world"
      

  2.   


    Option ExplicitPrivate Sub Command1_Click()
        Dim strP As String
        strP = Chr(34) & "ÖйúÈË" & Chr(34) '×Ö·û´®µÄÄÚÈÝÊÇ£º"ÖйúÈË"
        Debug.Print strP
    End Sub
    具体的查阅ASCII编码表格
      

  3.   

    可以如下吗?
    Dim str as stringstr = "hello"&""test""&"world"
    msgbox(str)难于理解:
    str = "hello ""test"" world"
      

  4.   

    用char(34)吧。写二个看得实在有点累。
      

  5.   


    这样写不报语法错误?1F的就是正确写法。你要想‘好理解’,就这样写吧:
    str = "hello " & chr$(34) & "test" & chr$(34) & "world"
      

  6.   

    "world" 应为 " world"-_-!!!