IStringList.InsertRange

Syntax

InsertRange(Index: Integer; Collection: ICollection);

Parameters

Index. Index of the position where the collection should be added.

Collection. Collection of elements that should be added to the array.

Description

The InsertRange method inserts collection of elements into the specified position.

Example

Sub UserProc;
Var
    StrL, StrL1: IStringList;
    i: Integer;
Begin
    StrL := New StringList.Create;
    StrL1 := New StringList.Create;
    For i := 0 To Math.RandBetweenI(50100Do
        StrL.Add("Number " + Math.RandBetweenI(0100).ToString);
    End For;
    For i := 0 To Math.RandBetweenI(50100Do
        StrL1.Add("Number " + Math.RandBetweenI(100200).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:

IStringList