MyChat Scripts Engine: Trim
Trimming spaces at the beginning and end of a specified string.
Syntax
function Trim(st: string): string;
Parameters and return values
Parameter |
Type |
Value |
st |
string |
source string. |
Function result
A string with deleted spaces on the left and right sides.
Example
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.
Script work result
[18:12:36] (Log "Trim"): [length: 23 / 12] |Hello world!|
[18:12:36] (Log "Trim"): [length: 22 / 18] |That's all, folks!|