I'm trying to replace "\v" in the string "Lapensee\v" with ""
string a = "Lapensee\v";
string b = a.Replace("\\v", "");
Console.WriteLine(b);
Output: Lapensee\v
Can anyone explain why this doesn't work?
I'm trying to replace "\v" in the string "Lapensee\v" with ""
string a = "Lapensee\v";
string b = a.Replace("\\v", "");
Console.WriteLine(b);
Output: Lapensee\v
Can anyone explain why this doesn't work?
\v in your string 'a', needs to be escaped too. Else it will be interpreted as a vertical tab.
I think you meant either:
string a = "Lapensee\\v";
or
string b = a.Replace("\v", "");
string a = "Lapensee\v";
string b = a.Replace("\v", ""); // You don't want the double \\
Console.WriteLine(b);
Since you have \v in the string a, you should also replace it with \v.