Page tree
Skip to end of metadata
Go to start of metadata

Introduced in




Takes an array, and returns a new array with the specified index(es) removed.

This takes the array passed in the first parameter, and returns an array that has the element indexed by the second parameter removed. If a third parameter is passed, then a range of indexes is removed. Alternatively, you can pass an array of indexes to remove in the second parameter.

This function does not touch the original array (passed as a parameter).


Syntax:[arrayIn, removalIndex, endIndex] call fn_vbs_removeIndex
  • arrayIn: Array - Source array.
  • removalIndex: Number or Array - Which element/s should be removed (in case several elements should be removed, an array is passed).
  • endIndex: Number - If included, all elements from removalIndex to endIndex are removed (optional).
Return Value:Array - Modified array.


When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.


_newarray = [[1,["b"],"c",[4],"d"], 2] call fn_vbs_removeIndex
// Returns: [1,["b"],[4],"d"] - element 2 ("c") is removed.
_newarray = [[1,["b"],"c",[4],"d"], [0,1,3]] call fn_vbs_removeIndex
// Returns: ["c","d"] - elements 0, 1, and 3 are removed
_newarray = [[1,["b"],"c",[4],"d"], 2, 3] call fn_vbs_removeIndex
// Returns: [1,["b"],"d"] - elements 2 to 3 are removed

Additional Information

See also: