TStringList.Move

procedure Move(CurIndex, NewIndex: Integer) CurIndex: String index that is supposed to be moved NewIndex: Target index

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, otherwise an exception occurs.

Warning
NewIndex is not the position in the stringlist before the move operation starts. The move operation 1. removes the string from position CurIndex 2. inserts the string at position NewIndex This may not lead to the desired result if NewIndex is bigger than CurIndex. Consider the following example:

Example
Example swaps 2 random elements of the list. It takes care of the case described in Warning section.