MyChat Scripts Engine: Length, get the size of a text string
Function to obtain a number of characters of a text string.
Syntax
function Length(sSt: string): integer;
Parameters and return values
Parameter |
Type |
Value |
sSt |
string |
source string. |
Function result
Returns the number of characters of the string.
Example
var
sData: array[1..4] of string;
i: integer;
begin
sData[1] := 'If I take you home tonight';
sData[2] := 'I will think of songs to sing to you';
sData[3] := 'Music filled with joy and light ';
sData[4] := 'If I take you home tonight';
for i := 1 to 4 do
mLogScript(sData[i], inttostr(length(sData[i])) + ' symbols');
end.
Script work result
[14:31:39] (Log "Length"): [26 symbols] If I take you home tonight
[14:31:39] (Log "Length"): [36 symbols] I will think of songs to sing to you
[14:31:39] (Log "Length"): [32 symbols] Music filled with joy and light
[14:31:39] (Log "Length"): [26 symbols] If I take you home tonight