SortRange(Index: Integer; Count: Integer);
Index. Index of the element, from which the range starts.
Count. Number of range elements.
The SortRange method sorts the array range in ascending order.
Sub UserProc;
Var
StrL: IStringList;
i: Integer;
Begin
StrL := New StringList.Create;
For i := 0 To Math.RandBetweenI(50, 100) Do
StrL.Add("Number " + Math.RandBetweenI(0, 100).ToString);
End For;
StrL.SortRange(10, StrL.Count - 20);
End Sub UserProc;
After executing the example a dynamic array of strings is generated, and the midsection of array, except for the first and last 10 elements, is sorted in ascending order.
See also: