json:subarray( $array as json:array, $startingLoc as xs:double, [$length as xs:double] ) as json:array
Extract a subarray from an array, producing a new array. The second and third arguments to this function operate similarly to those of fn:subsequence for XQuery sequences.
Parameters | |
---|---|
array | An array. |
startingLoc | The starting position of the start of the subarray. |
length | The length of the subarray. |
xdmp:to-json(json:subarray(json:to-array(1 to 6), 2, 4)) => [2, 3, 4, 5]