Method
Remove
Warning
This item was deprecated in version 2019r2. Please use Arrays.RemoveAt as a replacement.
Description
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 |
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"
Compatibility
All project types on all supported operating systems.
See also
Dim statement; Array, String, String, Arrays functions; Arrays, Arrays.IndexOf, Arrays, Redim, Arrays.Pop, Shuffle, Sort, Arrays.Sortwith methods; ParamArray keyword; Arrays concept