$$slice
Returns a slice of an array from a start index to end index (exclusive).
Usage​
{
"$$slice": [ /* values */ ],
"begin": /* begin */,
"end": /* end */,
}
"$$slice(<begin>,[end]):{input}"
Returns​
Same as value at specified index
Arguments​
Argument | Type | Values | Required / Default Value | Description |
---|---|---|---|---|
Primary | array | Yes | Array of elements | |
begin | integer | 0 | Index of first character to slice from (if negative, counts from the end of the array) | |
end | integer | End of array | Index of last character to slice to (if negative, counts from the end of the array) |
Examples​
Input
Definition
Output
[0, 1, 2, 3, 4, 5, 6, 7]
"$$slice(1):$"
[1, 2, 3, 4, 5, 6, 7]
[0, 1, 2, 3, 4, 5, 6, 7]
"$$slice(2,6):$"
[2, 3, 4, 5]
[0, 1, 2, 3, 4, 5, 6, 7]
"$$slice(3,-1):$"
[3, 4, 5, 6]
[0, 1, 2, 3, 4, 5, 6, 7]
"$$slice(-2):$"
[6, 7]
[0, 1, 2, 3, 4, 5, 6, 7]
"$$slice(-3,-1):$"
[5, 6]
[0, 1, 2, 3, 4, 5, 6, 7]
"$$slice(-2,-1):$"
[6]
[0, 1, 2, 3]
"$$slice:$"
[0, 1, 2, 3]