insertElement

Inserts an element into an array

No range checks are done, so an IndexOutOfBounds may occur

  1. T[] insertElement(T[] dat, T[] toInsert, uinteger pos)
  2. T[] insertElement(T[] dat, T toInsert, uinteger pos)
    T[]
    insertElement
    (
    T
    )

Return Value

Type: T[]

the modified array

Examples

assert([0, 2].insertElement(1, 1) == [0, 1, 2]);
assert([2].insertElement(1, 0) == [1, 2]);

Meta