Reputation: 111
I have a string which contains some trailing control characters:
'ase_Record'#$A#9#9#9'
I tried to use StringReplace
to remove the control characters, but could not make it work. How can I remove these control characters?
Upvotes: 1
Views: 2158
Reputation: 612894
You can use Trim
:
MyString := Trim(MyString);
From the documentation:
Trims leading and trailing spaces and control characters from a string.
Perhaps you only want to trim from the end of the string. In which case use TrimRight
. And for completeness there is also TrimLeft
for those times when you only want to trim from the start of the string.
Upvotes: 6