Insert(Index: Integer; Value: String);
Index. Index of the position, to which the element should be added.
Value. Value of the element that should be added.
The Insert method inserts the element into the specified position.
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.Insert(StrL.Count, "Last Value");
End Sub UserProc;
After executing the example a dynamic array of strings is generated at the end of the array, and one more element is added.
See also: