Hello,
Sorry, I read the question so that the problem was to delete the "_" characters. (underscore). Nothing about space or control chatcharaters. If you see my code it will delete those "_" characters and leave the space characters.
Misunderstood the "_ = Leerzeichen". word.

Could not believe it was about space characters what indeed can be solved by the trim function.
Greets,
Delphi-Lover.