Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use escape character in replace function when replacing quotations 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 "quotations" with the A but the program doesn't seem to recognize the fact that I'm using an escape character in VB. Does anyone know why? Thanks!

Robert

EDIT by rlbond86: This is clearly Visual Basic code. I have changed the title and text to reflect that.

like image 964
Robert Avatar asked Jun 07 '09 03:06

Robert


1 Answers

Looks like VB, not c++.

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

you want to use:

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

or

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

using " as escape character

also see: http://www.codecodex.com/wiki/index.php?title=Escape_sequences For info on escape sequences in multiple languages

like image 199
Jonathan Fingland Avatar answered Nov 20 '22 15:11

Jonathan Fingland