开发者

How to include " in a string

开发者_如何学运维

How do I include the " character in a string.

For example said = "John said "Hi""


You need to double up the quotes to escape them in VB

e.g. said = "John said ""Hi"""


There are also a set of Control Characters available:

Try

Dim s as String = "John said " & ControlChars.Quote & "Hi" & ControlChars.Quote

I find this much more readable than multiple quotes stacked together.


Add Chr(34) to the string!

Something like... Console.Write("Hello " + Chr(34) + "World" + Chr(34))


In VB.NET you must use 2 quotes: "John Said ""Hi"""

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜