Function Reference


Inserts a specified column into a 1D or 2D array

#include <Array.au3>
_ArrayColInsert ( ByRef $aArray, $iColumn )


$aArray Array to modify
$iColumn Column to insert - if array is 1D it is automatically converted to 2D

Return Value

Success: the number of columns remaining.
Failure: -1 and sets the @error flag to non-zero.
@error: 1 - $aArray is not an array
2 - $aArray is not a 1D or 2D array
3 - $iColumn is less than 0 or greater than upper array bound plus 1




#include <Array.au3>

Local $aArray[4] = [0, 1, 2, 3]
_ArrayDisplay($aArray, "Original")

_ArrayColInsert($aArray, 0)
; Now a 2D array
_ArrayDisplay($aArray, "Col 0 inserted")

_ArrayColInsert($aArray, 1)
_ArrayDisplay($aArray, "Col 1 inserted")

_ArrayColInsert($aArray, 3)
_ArrayDisplay($aArray, "Col 3 inserted")