MyChat Scripts: property TStringList.Count, a number of strings in a list
"For developers", "Server scripts", "Functions description", "Strings", "TStringList", "Properties", "Count".
Get the number of strings of the TStringList .
Syntax
property TStringList.Count: integer;
Example
var
SL: TStringList;
i, j: integer;
begin
SL := TStringList.Create;
for j := 1 to 10 do begin
SL.Clear;
for i := 1 to Random(10) + 1 do
SL.Append(IntToStr(Random(100)));
mLogScript(SL.CommaText, IntToStr(SL.Count) + ' elements');
end;
SL.Free;
end.
Script work result
[17:47:17] (Log "CountProperty"): [4 elements] 50,32,98,76
[17:47:17] (Log "CountProperty"): [6 elements] 10,81,18,38,97,66
[17:47:17] (Log "CountProperty"): [1 elements] 35
[17:47:17] (Log "CountProperty"): [3 elements] 72,65,17
[17:47:17] (Log "CountProperty"): [4 elements] 39,20,91,75
[17:47:17] (Log "CountProperty"): [4 elements] 58,52,8,94
[17:47:17] (Log "CountProperty"): [4 elements] 88,67,2,37
[17:47:17] (Log "CountProperty"): [2 elements] 70,76
[17:47:17] (Log "CountProperty"): [4 elements] 56,75,46,99
[17:47:17] (Log "CountProperty"): [4 elements] 98,47,57,79
[17:47:17] (Run "CountProperty"): Script operation time: 5 ms
[17:47:17] (Run "CountProperty"): Script done successfully.