How to use escape character in replace function when replacing quotes in VB

Here is my code snippet:

 Public Function convert(ByVal robert As String)
        Try
            robert = Replace(robert, "U", "A")
            robert = Replace(robert, "\"", "A")

I want to actually replace the “quotes” with A, but the program does not seem to recognize the fact that I am using the escape character in VB. Does anyone know why? Thanks!

Robert

EDIT by rlbond86: This is clearly Visual Basic code. I changed the name and text to reflect this.

+5
source share
1 answer

Similar to VB, not C ++.

See http://www.codingforums.com/archive/index.php/t-20709.html

which you want to use:

robert = Replace(robert, chr(34), "A")

or

robert = Replace(robert, """", "A")

using "as an escape character

.: http://www.codecodex.com/wiki/index.php?title=Escape_sequences escape-

+10

All Articles