Reverse;
The Reverse method inverts the array.
Sub UserProc;
Var
StrL: IStringList;
Begin
StrL := New StringList.Create;
StrL.Add("B");
StrL.Add("A");
StrL.Add("C");
StrL.Add("E");
Debug.WriteLine("Source array of strings:");
ShowList(StrL);
Debug.WriteLine("Array of strings after sorting:");
StrL.Sort;
ShowList(StrL);
Debug.WriteLine("Array of strings after array inversion:");
StrL.Reverse;
ShowList(StrL);
End Sub UserProc;
Sub ShowList(List: IStringList);
Var
s, res: String;
Begin
For Each s In List Do
res := res + s + ' ';
End For;
Debug.WriteLine(String.Trim(res));
End Sub ShowList;
After executing the example a dynamic array of strings is generated. Sorting and inversion of values are executed in the array. Array values at different stages of its transformation are displayed in the development environment console.
See also: