Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include " in a string

How do I include the " character in a string.

For example said = "John said "Hi""

like image 685
Kuzon Avatar asked Jul 14 '11 01:07

Kuzon


2 Answers

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

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

like image 58
Darren Gosbell Avatar answered Oct 21 '22 04:10

Darren Gosbell


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.

like image 30
JStevens Avatar answered Oct 21 '22 05:10

JStevens