TSubstringList.Move Method

procedure Move(const CurIndex, NewIndex: Integer);

Moves item CurIndex to NewIndex, the items between shifting by one.

#NameDescription
1CurIndex

The item's index, 0..Count - 1.

2NewIndex

Its index afterwards, 0..Count - 1.

Result: stored in self (calling object)

Remarks:

A sorted list raises EStringListError, before anything changes.

Examples

Moving the first item to the end.

uses Substr;

procedure Example;
var List: TSubstringList;
begin
    List := TSubstringList.Create(4);
    try
        List.Add('a');
        List.Add('b');
        List.Add('c');
        List.Move(0, 2);
        Assert(List[0] = 'b');
        Assert(List[2] = 'a');
    finally
        List.Free;
    end;
end;
See Also: TSubstringList.Exchange, TSubstringList.Insert