Remove

From Xojo Documentation

Revision as of 13:30, 4 January 2021 by PLefebvre (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Method

Removes an element from an array. Arrays are zero-based.

Usage

array.Remove index

Part Type Description
array Any data type Required. The array to remove the element from.
index Integer Required. The element number to be removed. Arrays are zero-based.

Notes

The Remove method removes the index element from the array. The resulting elements are shifted down to the removed element so that there are no gaps in the array.

The Remove method works with one-dimensional arrays only.

All arrays are indexed starting at position 0. Arrays can have a maximum index value of 2,147,483,646.

Sample Code

This example removes element 4 from the aNames array:

Dim names() As Text = Array("Bob", "Tom", "Jane")
names.Remove(1)
// names() = "Bob", "Jane"

See Also

Dim statement; Array, Join, Split, Ubound functions; Append, IndexOf, Insert, Redim, Pop, Shuffle, Sort, Sortwith methods; ParamArray keyword; Arrays concept