Inserts a new item into a list at any position.
ListInsert (lList, iIndex, aItem)
Variable | Description |
---|---|
lList | A variable containing the list to modify. inout LIST. |
iIndex | The position at which to insert the item. INTEGER. |
aItem | The item to insert. Its type must be compatible with the other items in the list. ANYTYPE. |
The list is modified by the call to ListInsert.
Silk Test Classic raises an exception if iIndex is less than one or greater than the number of items in the list.
[-] LIST ls = {...} [ ] "g" [ ] "s" [ ] ListInsert (ls, 2, "m") // inserts at 2nd position [ ] Print (ls) // prints: {g, m, s} [ ] ListInsert (1s, 1, "c") [ ] Print (ls) // prints: {c, g, m, s}