Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] array_slice expression function
- Loading branch information
1 parent
5bd2e88
commit 8978469
Showing
3 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"name": "array_get", | ||
"type": "function", | ||
"description": "Returns a portion of the array. The slice is defined by the startPos and endPos arguments. A slice that ", | ||
"arguments": [{ | ||
"arg": "array", | ||
"description": "an array" | ||
}, | ||
{ | ||
"arg": "startPos", | ||
"description": "the index of the start position of the slice (0 based). The startPos index is included in the slice. If you use a negative startPos, the index is counted from the end of the list (-1 based)." | ||
}, | ||
{ | ||
"arg": "endPos", | ||
"description": "the index of the start position of the slice (0 based). The endPos index is included in the slice. If you use a negative endPos, the index is counted from the end of the list (-1 based)." | ||
} | ||
], | ||
"examples": [{ | ||
"expression": "array_slice(array(1,2,3,4,5),0,3)", | ||
"returns": "array: 1,2,3,4" | ||
}, | ||
{ | ||
"expression": "array_slice(array(1,2,3,4,5),0,-1)", | ||
"returns": "array: 1,2,3,4,5" | ||
}, | ||
{ | ||
"expression": "array_slice(array(1,2,3,4,5),-5,-1)", | ||
"returns": "array: 1,2,3,4,5" | ||
}, | ||
{ | ||
"expression": "array_slice(array(1,2,3,4,5),0,0)", | ||
"returns": "array: 1" | ||
}, | ||
{ | ||
"expression": "array_slice(array(1,2,3,4,5),-2,-1)", | ||
"returns": "array: 4,5" | ||
}, | ||
{ | ||
"expression": "array_slice(array(1,2,3,4,5),-1,-1)", | ||
"returns": "array: 5" | ||
}, | ||
{ | ||
"expression": "array_slice(array('Dufour','Valmiera','Chugiak','Brighton'),1,2)", | ||
"returns": "array: 'Valmiera','Chugiak'" | ||
}, | ||
{ | ||
"expression": "array_slice(array_slice(array('Dufour','Valmiera','Chugiak','Brighton'),-2,-1)", | ||
"returns": "array: 'Chugiak','Brighton'" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters