G
Guest
How can I use a quote as a literal so it does get confused as not a literal?
Thanks!
Bob
Thanks!
Bob
How can I use a quote as a literal so it does get confused as not a literal?
Thanks!
Bob
BobAchgill said:How can I use a quote as a literal so it does get confused as not a
literal?
Thanks!
Bob
True, but ersonally I prefer to use ControlChars.Quote and build the stringpvdg42 said:If you mean within a string, try something like this:
Label1.Text = "This displays a quotation mark = ""!"
The double quotes before the exclamation mark will display as a single
quote, part of the literal.
BobAchgill said:So what would that look like in a literal string nested with variables? Like
this??
strMyString = "I am about to have a "COW" for the " + Counter + " time!"
strMyString = "I am about to have a ControlChars.Quote COW
ControlChars.Quote for the " + Counter + " time!"
Thanks! Bob
You have to put ControlChars.Quote outside of the string:
strMyString = "I am about to have a " & ControlChars.Quote & "COW" &
ControlChars.Quote & " for the " & Counter & " time!"
In my opinion, this is not easier to read than:
strMyString = "I am about to have a ""COW"" for the " & Counter & " time!"
Not to mention the minor performance hit for string concatenation for
using ControlChars.Quote
Not to mention the minor performance hit for string concatenation for
using ControlChars.Quote
Thanks,
Seth Rowe
ControlChars.Quote is a constant so the compiler concatenates it a
compile time. Now the Counter variable, not being a constant, will
cause a concatenation at runtime, but there's not performance hit to
using ControlChars.Quote. I agree with Goran that using "" is easier
to read.
Chris- Ocultar texto de la cita -
- Mostrar texto de la cita -
diAb0Lo said:Dim strCad as String = "I am about to have a ""COW"" for the " +
Counter + " time!"
Just using double quotes... Do I make myself clear?