MyChat Scripts: function TStringList.Insert, insert a string to a list
Insert a string to the list via specified index. The indexation starts from zero.
Syntax
procedure TStringList.Exchange(x, y: integer);
Parameters and return values
Parameter |
Type |
Value |
ildx |
integer |
position for inserting a string; |
s |
string |
text string for inserting. |
Example
var
SL: TStringList;
i: integer;
begin
SL := TStringList.Create;
for i := 1 to 10 do
SL.Add(IntToStr(i));
mLogScript(SL.CommaText, 'Original');
for i := 9 downto 1 do
SL.Insert(i, '---');
mLogScript(SL.CommaText, 'After');
SL.Free;
end.
Script work result
[15:02:21] (Log "InsertMethod"): [Original] 1,2,3,4,5,6,7,8,9,10
[15:02:21] (Log "InsertMethod"): [After] 1,---,2,---,3,---,4,---,5,---,6,---,7,---,8,---,9,---,10
[15:02:21] (Run "InsertMethod"): Script operation time: 5 ms
[15:02:21] (Run "InsertMethod"): Script done successfully.
See also
Created with the Personal Edition of HelpNDoc: Easily create PDF Help documents