Arrays.AddAt

From Xojo Documentation

Revision as of 18:50, 24 November 2020 by PLefebvre (talk | contribs) (Created page with "{{MethodBox | name=AddAt | platform=all | parameters=index As Integer, value As DataType | scope=public | owner=Arrays | newinversion=2020r2 }} {{Description |text = A...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Method

Arrays.AddAt(index As Integer, value As DataType)

New in 2020r2

Supported for all project types and targets.

Adds a new element into an array at the specified index.

Usage

array.AddAt index, value

Part Type Description
array array of any valid data type The array in which to add the new element.
index Integer The index in array to add the new element.
value Datatype of array The value to be assigned to the new array element.

Notes

The AddAt method works with one-dimensional arrays only.

Arrays can have a maximum index value of 2,147,483,646.

Sample Code

Consider the array names defined as follows:

names = Array("Leonard", "Abraham", "Herbert")

The statement:

names.AddAt(2, "Bill")

results in the following array:

names
Leonard
Abraham
Bill
Herbert

See Also

Arrays for a complete list of functions.