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
|
edit
array to slice |
|
offset
number,
required
|
edit
start position in the original array to slice |
|
length
number,
optional
|
edit
number of elements to slice from offset |
Examples
editGets 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 open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)