PDA

View Full Version : String.Replace question


Pip-Boy
03-23-2004, 07:44 AM
I would like to use String.Replace to change all instances of "\" in a file path to "\\". This seems complicated by "\" being used to make a special character display as a literal, like in input masks.

I haven't found a way to denote "\\" in my String.Replace action yet because of this. Is there a way to do this?

On another note, I would ask Corey to please not delete my post, or if you do at least respond to my private messages in some way. I'm not a secondary account of another user.

Worm
03-23-2004, 08:12 AM
sText = TextFile.ReadToString(_SourceFolder .. "\\text.txt");
sText = String.Replace(sText, "\\", "\\\\", false)

Pip-Boy
03-23-2004, 08:24 AM
Great, thank you. I hadn't thought of trying multiple \'s.