How do you escape double quotes in concatenated strings?
Hi,
How can I get the IDE to ignore double quotes in concatenation exercises (see below):
Code Snippet
Dim myString As String = "This is a "double quote" situation" & myOtherString & " and I need a resolution."
Dim myOtherString As String = "gentlemen"
Any ideas on how you escape those "double quote" double quotes?
Ger
[566 byte] By [
GerardL] at [2008-1-7]
Well you can just use two double quotes in a row:
Dim myString as String = "This is a ""double quote"" situation"
But when you are doing several concats, it is better to use the String.Format method:
Dim myString As String = String.Format("This is a {0}double quote{0} situation {1} and I need a resolution", ControlChars.Quote, myOtherString)
Hope that helps!