Lucee Function Reference

arraysplice()

Modifies an array by removing elements and adding new elements.
It starts from the index, removes as many elements as specified by elementCountForRemoval,
and puts the replacements starting from index position.
Return the removed elements.

Example

arraysplice(array array,numeric index,[numeric length,[array replacements]]):array

Category

array

Arguments

The arguments for this function are set. You can not use other arguments except the following ones.
Name Type Required Description
array array  Yes the array to modify.  
index numeric  Yes The position at which to start modifying the array. If the index is greater than the length of the array,
the index is set to the length of the array.
If the index is less than 1, the index is set to 1.  
length numeric  No The number of elements to be removed starting with the start index.
If length is 0 or smaller than -1, no elements get removed.
if length is -1 or GTE than array length-index, all elements after index get removed.  
replacements array  No Array to be added to the array starting with index.