本帖最后由 C.L 于 2010-10-7 17:17 编辑
回复 4# afan
OK,这个容易解决,只要稍稍改动一下代码
#include <array.au3>
Dim $a[2][4] = [[1,2,3,4],[5,6,7,8]]
_ArrayDeleteCol ($a,-5)
_ArrayDisplay ($a)
Func _ArrayDeleteCol(ByRef $avArray, $iElement)
If Not IsArray($avArray) Then Return SetError(1, 0, 0)
Local $iUBound = UBound($avArray, 1) - 1
Local $iUBound2 = UBound($avArray, 2) -1
If Not $iUBound Then
$avArray = ""
Return 0
EndIf
If $iElement < 0 Then
$iElement = $iUBound2 + $iElement + 1
If $iElement < 0 Then $iElement = 0
EndIf
If $iElement > $iUBound2 Then $iElement = $iUBound2
Switch UBound($avArray, 0)
Case 1
$avArray = ''
Case 2
For $i = 0 To $iUBound
For $j = $iElement To $iUBound2 -1
$avArray[$i][$j] = $avArray[$i][$j+1]
Next
Next
ReDim $avArray[$iUBound+1][$iUBound2]
Case Else
Return SetError(3, 0, 0)
EndSwitch
Return $iUBound
EndFunc ;==>_ArrayDeleteCol
|