我有一个包含一些尾随控制字符的字符串:
'ase_Record'#$A#9#9#9'
我尝试使用StringReplace
删除控制字符,但无法使其工作。如何删除这些控制字符?
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.