Sign in to follow this  
Followers 0
sshrum

_ArrayDeleteRow

1 post in this topic

Func _ArrayDeleteRow(ByRef $avArray, $iElement)
    Local $iR = 0, $iC = 0, $iRows = 0, $iCols = 0
    If (Not IsArray($avArray)) Then
        SetError(1); not an array
        Return ""
    EndIf
    Local $iRows = UBound($avArray); Row count
    Local $iCols = UBound($avArray, 2) ; Column count
    If $iRows = 1 Then
        SetError(2); 1 row
        Return ""
    EndIf
    If $iElement < 0 or $iElement > ($iRows - 1) Then
        seterror(3); out of row bounds
        Return ""
    EndIf
    Local $avNewArray[$iRows - 1][$iCols]
    for $iR = 0 to $iRows - 2
        if $iR = $iElement then ContinueLoop
        for $iC = 0 to $iCols - 1
            $avNewArray[$iR][$iC] = $avArray[$iR][$iC]
        Next
    Next
    $avArray = $avNewArray
    SetError(0)
    Return 1
EndFunc  ;==>_ArrayDeleteRow


Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0