字符串中包含双引号 
在字符串处理时,如果字符串变量必须有引号,怎么处理呢?如 
theStr = [MyName = "schunter" Class = "2"] 
如何将此字符串显示出来呢? 
很多初学者肯定使用了C/C++的方法,""",或者""",这些在Vb中都是错误的。正确的写法是: 
theStr = "[MyName =" & """" & "schunter" & """" & " Class = " & """" & "2" & """" & "]" 
也就是有引号的地方,需要两个引号才能生成一个引号。

解决方案 »

  1.   

    再加一个引号
    Debug.Print "a""s"
      

  2.   

    Dim str As String
    str = """Give the solution"",he said"
      

  3.   

    s=chr(34) & "Give the solution" & chr(34) & ",he said"結貼
      

  4.   

    谢谢jinhaiou(辛) ,不过老实说,我觉得这样太不方便了,只能这么用吗?有没有简便点的方法?
      

  5.   

    s = """Give the solution"",he said"
    --------------------------------------------
    用2个双引号代表一个双引号