471,354 Members | 1,187 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

Replacing escape character?

I have a string with the following XML and need to remove all of the
back slashes

"<ROOT><Person PersonId=\"56102\" /><Person PersonId=\"56104\"
/><Person PersonId=\"71266\" /></ROOT>"

I use

string newstring = cleanXML.Replace(@"\", "");

or

string newstring = cleanXML.Replace("\\", "");

But the back slashes remain. What is needed to remove them?

Thanks,
Brett

Dec 29 '05 #1
2 6570
KJ
..Replace(@"\\", "")

Dec 29 '05 #2
Brett Romero <ac*****@cygen.com> wrote:
I have a string with the following XML and need to remove all of the
back slashes

"<ROOT><Person PersonId=\"56102\" /><Person PersonId=\"56104\"
/><Person PersonId=\"71266\" /></ROOT>"

I use

string newstring = cleanXML.Replace(@"\", "");

or

string newstring = cleanXML.Replace("\\", "");

But the back slashes remain. What is needed to remove them?


Both of those will remove the backslashes. How are you determining that
the backslashes are there in the first place, and that they're there
afterwards? If it's by looking in the debugger, this may be confusing
you. See
http://www.pobox.com/~skeet/csharp/s....html#debugger

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 29 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

18 posts views Thread by Steve Litvack | last post: by
11 posts views Thread by Dimitris Georgakopuolos | last post: by
4 posts views Thread by Guadala Harry | last post: by
15 posts views Thread by pkaeowic | last post: by
131 posts views Thread by Lawrence D'Oliveiro | last post: by
7 posts views Thread by Christof Nordiek | last post: by
2 posts views Thread by John Smith | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.