Trimming spaces at the beginning and end of a specified string.
function Trim(st: string): string;
Parameter |
Type |
Value |
---|---|---|
st |
string |
source string. |
A string with deleted spaces on the left and right sides.
const
sFirst = ' Hello world!';
sSecond = 'That''s all, folks! ';
var
s: string;
begin
s := trim(sFirst);
mLogScript('|' + s + '|', 'length: ' + inttostr(length(sFirst)) + ' / ' + inttostr(length(s)));
s := trim(sSecond);
mLogScript('|' + s + '|', 'length: ' + inttostr(length(sSecond)) + ' / ' + inttostr(length(s)));
end.
[18:12:36] (Log "Trim"): [length: 23 / 12] |Hello world!|
[18:12:36] (Log "Trim"): [length: 22 / 18] |That's all, folks!|