1

我有一个包含一些尾随控制字符的字符串:

'ase_Record'#$A#9#9#9'

我尝试使用StringReplace删除控制字符,但无法使其工作。如何删除这些控制字符?

4

1 回答 1

6

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.

于 2013-02-06T09:50:43.387 回答