By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,238 Members | 1,609 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,238 IT Pros & Developers. It's quick & easy.

Adding a " to a string

P: n/a
Hello,

I want to do concatenate two strings together and insert double quotes " in
between them. How do I do that. It doesn't like:

string1 & """ & String2

Thanks
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
String1 = "ABC"
String2 = "DEF"

String1 & """" & String2 (result is ABC"DEF)

or

String1 & """""" & String2 (result is ABC""DEF)

"paul reed" <pr****@jacksonreed.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hello,

I want to do concatenate two strings together and insert double quotes " in between them. How do I do that. It doesn't like:

string1 & """ & String2

Thanks

Nov 20 '05 #2

P: n/a
* "paul reed" <pr****@jacksonreed.com> scripsit:
I want to do concatenate two strings together and insert double quotes " in
between them. How do I do that. It doesn't like:

string1 & """ & String2


\\\
x = string1 & """" & string2
///

Instead of a single double quote you need to write 2 double quotes.

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>

Improve your quoting style:
<http://learn.to/quote>
<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #3

P: n/a
Did you tried this:

Dim test1 As String = "test1"
Dim test2 As String = "test2"
Console.WriteLine("The result is: " & test1 & """" & test2)

The result is: test1"test2

Hope that helps

"paul reed" <pr****@jacksonreed.com> wrote in message news:<#n**************@TK2MSFTNGP11.phx.gbl>...
Hello,

I want to do concatenate two strings together and insert double quotes " in
between them. How do I do that. It doesn't like:

string1 & """ & String2

Thanks

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.