
How to Convert Escape Characters from C# to VB.NET
Thanks, but this is from C# to VB.NET .....and USING C# to do the convert...
You see C# sees
\" as just a "......so it's not recognizing the \" together.....it's also
really really tough to get at when the \" is are together like that....
I can't even recognize it on a per character basis......I was trying to
first search for a " via .IndexOf and then do a back track -1 to see if
there is \
BUT it still sees is it as a "
All this is in C#
I am not sure how to attack this problem of looking for an escape sequence
in C#
\" should convert to " in vb. The code you posted isn't vb code, in fact, it
wouldn't compile under any language; so I'm not sure what you were asking
about there... but as far as conversion goes, you must do it on a
per-character basis:
\" = ""
\n = " & vbCrLf & "
... ect ...
To program the conversion, you would do something like this:
Dim strTest as String
' set strTest = \"
strTest = "\"""
' replace \" with ""
strTest = strTest.Replace("\""", """""")
That's all you have to do...
HTH,
Jeremy
Quote:
> I have a character escape sequence
> \" which produces a quote, "
> However, how would I convert to this and all of them to "" for VB.NET
> When I do a simple replace for
> string test = "\""
> test = test.Replace(\\\" , "\"\"|)
> it still sees it as a quote, "
> Not as a \" ......thus it's not replaced.
> In other words, how does one convert escape sequences in C# to VB.NET?
> Thanks.