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 Main;

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(0,100).ToString);

End For;

StrL.InsertRange(Double.FloorInt(StrL.Count/2),StrL1 As ICollection);

End Sub Main;

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