TStrings.Move
Move a string from one place in the list to another.
Declaration
Source position: classesh.inc line 752
public
procedure Move(CurIndex: Integer; NewIndex: Integer); Virtual;
Description
Move moves the string at position CurIndex so it has position NewIndex after the move operation. The object associated to the string is also moved. CurIndex and NewIndex should be in the range of 0 to Count-1.
Remark
NewIndex is not the position in the stringlist before the move operation starts. The move operation
removes the string from position CurIndex inserts the string at position NewIndex
This may not lead to the desired result if NewIndex is bigger than CurIndex. Consider the following example:
With MyStrings do
begin
Clear;
Add('String 0');
Add('String 1');
Add('String 2');
Add('String 3');
Add('String 4');
Move(1,3);
end;
After the Move operation has completed, 'String 1' will be between 'String 3' and 'String 4'.
!!!
Errors
If either CurIndex or NewIndex is outside the allowed range, an EStringListError is raised.
See also
Name | Description |
---|---|
TStrings.Exchange | Exchanges two strings in the list. |