Question : C# How to remove <STX> and <ETX> characters from file

Hello,

I have an ascii file. And I read it to string.
Then I need to remove <STX> and <ETX> characters from file. But how to do it?
1:
2:
3:
4:
5:
CopyFileToStr("Lala.a00");

            //remove('\r');
            HexFileString.Remove(HexFileString.IndexOf(),1);
            HexFileString.Remove(HexFileString.IndexOf('\ '),1);
Attachments:
 
ascii file
ascii file
 

Answer : C# How to remove <STX> and <ETX> characters from file

Are they actually the control characters #2 and #3 at the beginning and end?   (and not literally "STX" or "ETX")
http://en.wikipedia.org/wiki/Control_character

If so, try something like:
1:
2:
3:
string filename = "Lala.a00";
string data = System.IO.File.ReadAllText(filename).TrimStart(new char[] {Convert.ToChar(2)}).TrimEnd(new char[] {Convert.ToChar(3)});
System.IO.File.WriteAllText(filename, data);            
Random Solutions  
 
programming4us programming4us