gudidi
asked on
replace double back slash with single one
Hi Experts
i have a string which contain path with double back slash and i need to replace it before run the query with
single back slash. nothing work now. any idea?
string sPath1="";
sPath1 = this.Path; // current value: C:\\ORADATA\\SPI2009
sPath1 = sPath1.Replace("\\\\", "\\");
sPath1 = sPath1.Replace(@"\\", @"\");
none of 2 option is works.
10x
i have a string which contain path with double back slash and i need to replace it before run the query with
single back slash. nothing work now. any idea?
string sPath1="";
sPath1 = this.Path; // current value: C:\\ORADATA\\SPI2009
sPath1 = sPath1.Replace("\\\\", "\\");
sPath1 = sPath1.Replace(@"\\", @"\");
none of 2 option is works.
10x
ASKER
hi
this path is a part of query for Oracle,
the Oracle can not accept double quote so i need to remove it.
10x
this path is a part of query for Oracle,
the Oracle can not accept double quote so i need to remove it.
10x
ASKER
sorry i ment double back slash...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
10x a lot.
you right. now i understand and it works fine now because the problem was in the script.
enjoy your points.
10x
you right. now i understand and it works fine now because the problem was in the script.
enjoy your points.
10x
Well, you're really more correct than you think. :)
I like to use this syntax:
"\\any\\".Replace("\0x005C
If you inspect the value of the above in the Visual Studio debugger, you will see:
"\\any\\"
You will then conclude that it did not work. But if you try this:
"\\any\\".Replace("\0x005C
You will see that the length is 5--2 for each "\" and 3 for "any". In other words, the string is correct even though it doesn't look that way in the watch window.
Your first AND second examples above are actually correct. :)
Regards,
Jon500