easy question...... I am having dumb moment.
-
i have looked in my books, I have looked online, I have looked in code Project. Why can't I find this simple answer to my question. I must not be working it correctly on the search engines. Maybe someone here can help me. Here is goes. This should be a no brainer. I want to write to a file. I want to put a literal " in the string. How do I do that in Vb .net? I tried """ with no luck. So, does anyone know this answer that I should probably be able to recite in my sleep.
-
i have looked in my books, I have looked online, I have looked in code Project. Why can't I find this simple answer to my question. I must not be working it correctly on the search engines. Maybe someone here can help me. Here is goes. This should be a no brainer. I want to write to a file. I want to put a literal " in the string. How do I do that in Vb .net? I tried """ with no luck. So, does anyone know this answer that I should probably be able to recite in my sleep.
-
i have looked in my books, I have looked online, I have looked in code Project. Why can't I find this simple answer to my question. I must not be working it correctly on the search engines. Maybe someone here can help me. Here is goes. This should be a no brainer. I want to write to a file. I want to put a literal " in the string. How do I do that in Vb .net? I tried """ with no luck. So, does anyone know this answer that I should probably be able to recite in my sleep.
Use 4 double quotes. One for each of start and end of string, 1 as an escape character and 1 for the string content. Great syntax vb uses here!
"An eye for an eye only ends up making the whole world blind"
-
i have looked in my books, I have looked online, I have looked in code Project. Why can't I find this simple answer to my question. I must not be working it correctly on the search engines. Maybe someone here can help me. Here is goes. This should be a no brainer. I want to write to a file. I want to put a literal " in the string. How do I do that in Vb .net? I tried """ with no luck. So, does anyone know this answer that I should probably be able to recite in my sleep.
In addition to the above posts, if you have to add a lot of quotes as you are creating a string, I would suggest creating a quote String and then just add it wherever you need a quote.
Dim quoteStr As String = """" MsgBox(quoteStr + "Hello" + quoteStr)
It makes it easier to read if you are working with lots of strings. -
i have looked in my books, I have looked online, I have looked in code Project. Why can't I find this simple answer to my question. I must not be working it correctly on the search engines. Maybe someone here can help me. Here is goes. This should be a no brainer. I want to write to a file. I want to put a literal " in the string. How do I do that in Vb .net? I tried """ with no luck. So, does anyone know this answer that I should probably be able to recite in my sleep.
-
You can also do Chr(34) where you want the quotes.
MsgBox(Chr(34) & "This is in quotes." & Chr(34))
But that's just nasty as all hell, obviously.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Use 4 double quotes. One for each of start and end of string, 1 as an escape character and 1 for the string content. Great syntax vb uses here!
"An eye for an eye only ends up making the whole world blind"
Rob Smiley wrote:
Great syntax vb uses here!
That'z VB. :)
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson -
But that's just nasty as all hell, obviously.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
But that's just nasty as all hell, obviously.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
When I am not in C# I still use the Convert.ToChar(10)+Convert.ToChar(13) for a return/newline character.
Regards, Thomas Stockwell Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Visit my homepage Oracle Studios Discounted or Free Software for Students: DreamSpark - downloads.channel8.msdn.com MSDN Academic Alliance - www.msdnaa.com