The program takes the key value from the registry, but in the resulting string there are unknown characters that interfere with the proper handling of strings. The program itself does not display these symbols in ordinary Label.

For example, the program received a string in the log file:

line in the log file

On the web page:

same line on web page

And I need to somehow trim everything starting from nul. How to do it?

  • Perhaps this will help you: stackoverflow.com/questions/1522884/… - trydex pm
  • @trydex this was useful, but did not help. Maybe you know how to cut everything starting from nul? Something like string.Remove(string.IndexOf(nul)) but I don’t know what the code for the symbol nul. - Dez Max
  • one
    @DezMax go through the line, looking for when will hit on 0x00 (str [i] == '0x00'. Then you get the position of the symbol NUL and make str.Split (). - Arantler

1 answer 1

string.Remove(string.IndexOf("\x00"));