HelloWorld HelloWorld - 1 year ago 89
C# Question

Remove " and \ using Replace

string a = "\"address\": {\r\n \"label\":"

string b = "{\r\n \"label\":"

a.replace(""\"address\": ", "")

The goal is to remove the data ""\"address\":" and retrieve the same value as string b?

Answer Source

When you want to parse a double quote in a string you must place a slash before the quote: "\"" Not like it's needed in this example anyway, since it is already embbeded in the string. The solutionn to your question:

        string a = "\"address\": {\r\n  \"label\":";
        string b = "{\r\n  \"label\":";
        a = a.Replace("\"address\": ", "");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download