How to include " in string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can somebody please help me and tell me how to include the " symbol in a
string?
 
use "" (two double-quotes)
for example -

Dim str As String = "test ""string"""
Console.WriteLine(str)

Output:
test "string"

Imran.
 
""

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing
 
As is always the case, I look for half an hour, post a question on here, then
work out the answer... (chr(34)).
 
Colmag said:
how to include the " symbol in a
string?

\\\
Dim s As String = _
"He said: ""Hello World!"""
Dim t As String = _
"He said: " & ControlChars.Quote & "Hello World!" & ControlChars.Quote
///

Notice that there is no performance loss in using the string
concatenation operator in the 2nd sample, the string is concatenated by
the compiler and stored as a single constant in the assembly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top