InsertRange(Index: Integer; Collection: ICollection);
Index. Index of the position where the collection should be added.
Collection. Collection of elements that should be added to the array.
The InsertRange method inserts collection of elements into the specified position.
Sub UserProc;
Var
StrL, StrL1: IStringList;
i: Integer;
Begin
StrL := New StringList.Create;
StrL1 := New StringList.Create;
For i := 0 To Math.RandBetweenI(50, 100) Do
StrL.Add("Number " + Math.RandBetweenI(0, 100).ToString);
End For;
For i := 0 To Math.RandBetweenI(50, 100) Do
StrL1.Add("Number " + Math.RandBetweenI(100, 200).ToString);
End For;
StrL.InsertRange(Double.FloorInt(StrL.Count / 2), StrL1 As ICollection);
End Sub UserProc;
After executing the example two dynamic arrays of strings are generated, and values of the second one are added to the middle of the first.
See also: