I have tried

newstring = oldstring.Replace(Convert.ToChar(92), ' ');

newstring = oldstring.Replace("\\", " ");

Neither of which works. I am tring to take out all \ (slashes). Please help.

Re: String.Replace to replace \ (slash) by Anders

Anders
Mon Dec 13 02:02:35 CST 2004

>I have tried
>
> newstring = oldstring.Replace(Convert.ToChar(92), ' ');
>
> newstring = oldstring.Replace("\\", " ");
>
> Neither of which works. I am tring to take out all \ (slashes). Please
> help.

Both of these should work.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/



Re: String.Replace to replace \ (slash) by Jon

Jon
Mon Dec 13 02:13:51 CST 2004

David C <nospam@nospam.com> wrote:
> I have tried
>
> newstring = oldstring.Replace(Convert.ToChar(92), ' ');
>
> newstring = oldstring.Replace("\\", " ");
>
> Neither of which works. I am tring to take out all \ (slashes). Please help.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

As Anders said, both of the above will work.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too