• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 742
  • Last Modified:

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

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?
0
Stovetop
Asked:
Stovetop
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
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
0
 
jpaulinoCommented:
Try this way:

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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now