How can I remove the back slash char from the end of a Syslog line?
It is not visible, so I think it might be CR or LF. But I am unsure in which way to use Trim.
Use a hex editor to open the syslog file and find the "slash" at the end of the file. Look to see what the character is in hex. For example, if it was a CR and LF the hex codes would be 0D and 0A. Once you have found this value then use the following code.
Code:
//buffer containing the syslog file data
buffer = buffer.TrimEnd('\x0D', '\x0A'); //or whatever character you want to remove
Use this if the only instance of this slash is at the end of the file. If it is throughout the whole file then use something like this.
You could also read the file in line by line and trim the character off the end of each line, there are a few different ways of doing this. You just need to find the best way for you. Hope this all helps.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.