Putting a single double-quote into a String in VB.NET

Posted on 2008-11-10
Last Modified: 2012-05-05
I am trying to refer to a single double-quote, not a pair of double-quotes, within a String in VB.NET, as in:

str = str.Replace("L", "A"), except with the 'L' being a ' " '.

Is such a thing possible?
Question by:Stovetop
    LVL 69

    Accepted Solution

    you can do it at least using 2 different ways:
    str = str.Replace("''", "A")  'placing 2 (between 2) means 1
    str = str.Replace(Convert.ToChar(34), "A")  'may be clearer
    LVL 48

    Expert Comment

    Try this way:

    Dim str As String = """Latitude and Longitude"
    str = str.Replace("""L", """X").Replace("L", "A").Replace("""X", """L")

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now