Difference between revisions of "Insert"

From Xojo Documentation

m (1 revision)
 
m (1 revision)
(No difference)

Revision as of 18:53, 19 November 2009


Description

Inserts a new element into an array. Arrays are zero-based.


Syntax

array.Insert index, value

Part Type Description
array array of any valid data type The array in which to insert the new element.
index Integer The position in array to insert the new element, i.e., the index of the new element.
value Datatype of array The value to be assigned to the new array element.


Notes

The Insert method works with one-dimensional arrays only.


Examples

Suppose array "a" is defined as:

a=Array("Leonard","Adolph","Herbert")

The statement:

a.Insert 2, "Bill"

results in the following array:

Leonard|-
Array Element
Adolph
Bill
Herbert


See Also

Append, Array, IndexOf, Pop, Redim, Remove, Shuffle, Sort, Sortwith methods; Dim, Redim statements; UBound function.