我试图在富文本框中找到此文本字符串并将其删除,
Dim String1 As String = "<?xml version= "1.0" encoding =" UTF-16"?>"
但是,我一直收到“语句结束预期错误”。
感谢您的帮助。
答案 0 :(得分:4)
我提供答案是怎么回事,因为我提供了答案:)
逃避双引号:
"<?xml version= ""1.0"" encoding ="" UTF-16""?>"
答案 1 :(得分:1)
如MSDN documentation on VB.NET string literals中所述:
Within a string, a sequence of two double-quote characters is an escape sequence
representing a double quote in the string.
因此,您需要通过在其前面添加另一个双引号char来转义String
字面值中的每个双引号,如下所示:
Dim String1 As String = "<?xml version= ""1.0"" encoding ="" UTF-16""?>"