none
Quoting Quotes in Visual Basic

    Question

  • I'm finding it very difficult to Quoting a Quoted String in Visual Basic or Declaring a String that has a string value in quotes.

    Does anyone know how can i do this?
    Tuesday, July 8, 2008 12:44 PM

Answers

  • In VB, a double quote is escaped by another double quote.
    e.g.,
    Dim s As String = "abc""def"

    Convert between VB, C#, C++, and Java (http://www.tangiblesoftwaresolutions.com)
    • Marked as answer by GaaTY Tuesday, July 8, 2008 3:08 PM
    Tuesday, July 8, 2008 2:59 PM

All replies

  • In VB, a double quote is escaped by another double quote.
    e.g.,
    Dim s As String = "abc""def"

    Convert between VB, C#, C++, and Java (http://www.tangiblesoftwaresolutions.com)
    • Marked as answer by GaaTY Tuesday, July 8, 2008 3:08 PM
    Tuesday, July 8, 2008 2:59 PM
  • Thanks!

    I tried it before though, and for some reason it didnt work.

    Like for example:
    Dim greeting As String = "Hello"

    but what i wanted was:
    Dim greeting As string = ""Hello""

    but Visual basic didnt allow that also.

    SO what i did now was add a third set of double quotes, """Hello""" and it worked.

    I kinda understand it better now. Thanks!
    Tuesday, July 8, 2008 3:11 PM