Skip to main content

Slice

Command Description

Slices the array from a specified range of point and returns the slice

Command Prototype

arrRet = splice(array,begin,end)

Parameter Description

ParameterRequiredTypeDefaultDescription
arrayTrueexpression[]Need to get the array elements of an array
beginTruenumber0The start position of the sliced element
endTruenumber0The index number representing the end of the slice

return

arrRet,The variable used to save the output of the command.

Demo

TracePrint("----------------------Intercept array------------- -") 
//-------------------------------------------------------------------------------
//[Remarks] Delete and return the first element of the array.
//Input parameter 1:
// array--The array that needs to intercept the elements of the array.
//Input parameter 2:
// begin--The starting position of the element to be intercepted.
//Input parameter 3:
// end--The end position of the element to be intercepted.
//out parameters:
// arrRet--The variable to which the output of the function call is saved.
//
//Command prototype: arrRet=splice(array,begin,end)
//-------------------------------------------------------------------------------
arrRet=splice(["a","b","c","d"],0,1)
TracePrint(arrRet)