ArraySlice()
Returns a new array, from the start position up to the count of elements
ArraySlice( array=array, offset=number, length=number );
Returns: Array
Argument | Description |
---|---|
array
array,
required
|
array to slice |
offset
number,
required
|
start position in the original array to slice |
length
number,
optional
|
number of elements to slice from offset |
Examples
Gets a sub section of an array and returns it
newArray = ['a','b','c','b','d','b','e','f'];
dump(newArray);
hasSome1 = arraySlice(newArray,1,4);
dump(hasSome1);
// member function
hasSome2 = newArray.slice(3,6);
dump(hasSome2);
See also
- Arrays
- array.slice()
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)