Reputation: 493
I have string in which some xml resides.
The string is:
string xmlRead = "<ns0:RequestedAmount xmlns:ns0=\"http://tempuri.org/XMLSchema.xsd\"> <ns0:RequestedAmount></ns0:RequestedAmount> </ns0:RequestedAmount>" +
"<ns0:Response xmlns:ns0=\"http://tempuri.org/XMLSchema.xsd\"> <ns0:Response/> </ns0:Response>" +
"<ns0:isValid xmlns:ns0=\"http://tempuri.org/XMLSchema.xsd\"> <ns0:isValid/> </ns0:isValid>";
I have tried this:
string s=xmlRead.Replace(@"\","");
string s=xmlRead.Replace("\"","");
string s=xmlRead.Replace(@"\",string.Empty);
Nothing is working kindly help me out what I am doing wrong here.
Upvotes: 0
Views: 5277
Reputation: 87
Use following code this will help you.
string x=@"ABCD\EFG";
string y=x.Replace(@"\","");
Upvotes: 0
Reputation: 14618
Those backslashes won't actually appear in the final string. They are just escape sequences for the quotes ""
.
My guess is that you're viewing the string in the debugger which will still show them as unescaped.
Upvotes: 8