How to include "in a string

How to include a character in a string.

For example, said = "John said "Hi""

+6
source share
4 answers

There is 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 a few quotes put together.

+10
source

You need to double quotes to avoid them in VB

eg. said = "John said ""Hi"""

+14
source

Add Chr (34) to the line!

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

+4
source

In VB.NET, you must use 2 quotation marks: "John Said ""Hi"""

+3
source

Source: https://habr.com/ru/post/892723/


All Articles