Hi Alan,
The article explains how to do string manipulation
Basically, if you have a string of several \ where there should be only 1
you can do it like this
string s = @"c:\windows\\microsoft.net\\\framework\\\";
while (s.IndexOf(@"\\") -1)
s = s.Replace(@"\\", @"\");
The @ means treat \ as a backslash, not as an escape character
On Tue, 10 Oct 2006 05:16:45 +0200, Alan T <al*************@yahoo.com.au
wrote:
Sorry, I don't follow the article if it helps in my problem.
Is there a way to get rid of the extra '\' in the directory string?
"John Timney (MVP)" <x_****@timney.eclipse.co.ukwrote in message
news:Xb********************@eclipse.net.uk...
>read how to trim here
http://www.csharphelp.com/archives4/archive616.html
--
Regards
John Timney (MVP)
"Alan T" <al*************@yahoo.com.auwrote in message
news:eX**************@TK2MSFTNGP04.phx.gbl...
>>I just wonder
c:\temp\\doc\\\root1\\\
it gives me that is valid directory but I need to get rid of the extra
'\'s
The system.io class has a directory exists method
Directory.Exists(path)
described here:
http://msdn2.microsoft.com/en-us/lib...y.exists..aspx
As long as you have the authenticated rights to check that locationit
will tell you if a path exists.
How do I check if the directory path is valid and exists ?
>
eg.
\\myserver\temp\\\\\\
>
c:\temp\\doc\\\\\\root1
--
Happy Coding!
Morten Wennevik [C# MVP]