I use C# basically. There I can do:
string trimmed = str.Trim('\t');
to trim tabulation from the string str
and return the result to trimmed
.
In delphi7 I found only Trim
, that trims spaces.
How can I achieve the same functionality?
There is string helper TStringHelper.Trim that accepts array of Char as optional parameter.
function Trim(const TrimChars: array of Char): string; overload;
So, you can use
trimmed := str.Trim([#09]);
for your example. #09
here is ASCII code for Tab character.
This function exists since at least Delphi XE3.
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With