c# - How to replace "0x1B" in a file with nothing ie remove -
i using asp.net mvc3, c#, .net 4.5
i need remove "escape" characters seem appearing in html file.
i trying:
newhtml = oldhtml.replace("0x1b","")
but think have wrong here. please advise.
the replace correct doubt string right..
you need convert hex value first character , string:
string esc = ((char)0x1b).tostring()
to remove 1 character in question use :
newhtml = oldhtml.replace( ((char)0x1b).tostring(), "" );
to remove several characters can this:
var chars = new char[] { (char)27, (char)0x1b, '\t', '~' }; string newhtml = oldhtml; foreach (var c in chars ) newhtml = str.replace(c.tostring(), string.empty);
i have combined few different ways create characters.
or can, , should go regular expression..
several other solutions can found here..
Comments
Post a Comment