Slice
- 27 May 2022
- 1 Minute to read
-
DarkLight
-
PDF
Slice
- Updated on 27 May 2022
- 1 Minute to read
-
DarkLight
-
PDF
Selects the items starting at the given Start index and ending at the given End index.
Note that the element at the given end index is not included.
You can use a negative end index to select from the end of the list.
Function signature
SLICE(list: Array, start: Number, end: Number) => Array
Parameter | Description |
---|---|
List | List to slice |
Start | Index of the first item |
End | Index where the range ends, not including item at this index. Negative index will be calculated from the end of the list. |
Examples
Formula | Return value |
---|---|
SLICE(["a", "b", "c", "d"], 1, 3) |
["b","c"] |
SLICE(["a", "b", "c", "d"], 0, -1) |
["a","b","c"] |
SLICE(["a", "b", "c", "d"], 2) |
["c","d"] |
Was this article helpful?