ExcludeArrayElements()

Summary

Removes elements from an array.

Syntax

new_array = ExcludeArrayElements(array my_array, integer start, integer count)

Argument Contents
my_array The array from which elements are removed
start The position of the first element to be removed
count The number of elements that are removed

Returns

An array containing the remaining elements of my_array, or null if all the elements of my_array are removed.

Notes

  • If start is null, ExcludeArrayElements() removes elements from the beginning of my_array.

  • ExcludeArrayElements() does not modify my_array; it creates a new array containing a subset of the elements.

Example

A = {1, 2, 3, 4, 5}
B = ExcludeArrayElements(A, 2, 3) // Now, B equals {1, 5}
A = ExcludeArrayElements(A, 1, 2) // Now, A equals {3, 4, 5}

Error Codes

Error Type Meaning
Error Start is less than one, or count is less than zero.

See Also

Function Summary
ArrayExclude() Excludes elements from an array
ArrayIntersect() Creates an array that contains the elements of the array a that are also in array b
ArrayUnion() Returns a new array containing all unique elements from arrays a and b.
InsertArrayElements() Inserts elements into an array
Subarray() Extracts a number of elements from an array