MyChat Scripts: function TStringList.Move, move the string to a specified position
"For developers", "Server scripts", "Functions description", "Strings", "TStringList", "Methods", "Move".
A method for moving a text string to a new position. The indexation starts with zero.
Syntax
procedure TStringList.Move(iIdxFrom, iIdxTo: integer);
Parameters and return values
Parameter |
Type |
Value |
iIdxFrom |
integer |
string index; |
iIdxTo |
integer |
position. |
Example
var
SL: TStringList;
i: integer;
begin
SL := TStringList.Create;
SL.Sorted := false;
SL.CommaText := 'I,II,III,IV,V';
mLogScript(SL.CommaText, 'Original');
for i := 1 to 5 do begin
SL.Move(0, SL.Count - 1);
mLogScript(SL.CommaText, IntToStr(i) + ' step');
end;
SL.Free;
end.
Script work result
[17:10:37] (Log "MoveMethod"): [Original] I,II,III,IV,V
[17:10:37] (Log "MoveMethod"): [1 step] II,III,IV,V,I
[17:10:37] (Log "MoveMethod"): [2 step] III,IV,V,I,II
[17:10:37] (Log "MoveMethod"): [3 step] IV,V,I,II,III
[17:10:37] (Log "MoveMethod"): [4 step] V,I,II,III,IV
[17:10:37] (Log "MoveMethod"): [5 step] I,II,III,IV,V
[17:10:37] (Run "MoveMethod"): Script operation time: 5 ms
[17:10:37] (Run "MoveMethod"): Script done successfully.