[UDF] Tableaux flexibles : Fonctions complexes sur les tableaux

Partagez des fonctions et des UDF AutoIt.
Règles du forum
.
Répondre
Avatar du membre
Numeric
Niveau 5
Niveau 5
Messages : 125
Enregistré le : mer. 23 mars 2016 08:17
Status : Hors ligne

[UDF] Tableaux flexibles : Fonctions complexes sur les tableaux

#1

Message par Numeric »

Salut, le père noêl s'est manifesté. :D
Désormais vos tableaux seront plus complexes et plus flexibles :
#include <Array.au3>

Local $avArray[10]; exemple tiré d'un exemples sur _ArrayPop() AutoIt
$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"

Local $Array[5][4] = [["A", "B", "C", "D"], ["1", "A", "3", "4"], ["E", "F", "A", "H"], ["5", "6", "7", "A"], ["I", "J", "K", "Under Last_A or Start"]]
Local $B_Array = $Array
Local $C_Array = $avArray
_ArrayDisplay($Array, "Original Array")
;Variables
Local $ArrayReverse, $ArrayExtract, $ArraySearch, $ArrayReplace, $ArrayIsNotEmpty, $ArrayPop


$ArraySearch = __ArraySearchExact($Array, "A", 0)
_ArrayDisplay($ArraySearch, " __ArraySearchExact : Recherche de tous les emplacements [ligne-colonne] de A")

$ArrayExtract = __ArrayExtractExact($Array, 2, 4, 1, 3)
_ArrayDisplay($ArrayExtract, "Extract Rows[2-4] And Columns[1-3]: Extraction de tous les éléments de la [ligne 2 à 4][Colonne 1 à 3]")

$ArrayReplace = __ArrayReplaceInRange($Array, "A", "", 0)
_ArrayDisplay($ArrayReplace, "Remplace A par "" dans tous le tableau")

$ArrayIsNotEmpty = __ArrayIsNotEmpty($Array)
_ArrayDisplay($ArrayIsNotEmpty, "Array is Not Empty: Remplacement de toutes les zones vides par la valeur par defaut *")

For $Columns = 0 To 3
   $ArrayReverse = __ArrayReverse($Array, $Columns, 0, 0)
   _ArrayDisplay($ArrayReverse, "__ArrayReverseByCol  n° " & $Columns)
Next
$ArrayReverse = __ArrayReverse($Array, 3, 1, 4)
_ArrayDisplay($ArrayReverse, "ArrayReverse in Colomn 3, [Row 1 to 4]")

;Pour renverser toutes les colonnes on met le parametre $aColNum à -1
$ArrayReverse = __ArrayReverse($B_Array, -1, 0, 0)
_ArrayDisplay($ArrayReverse, "Reverse l'ordre de tous les éléments dans toutes les colonnes du tableau")

;Obtenir le tableau initial $B_Array
__ArrayReverse($B_Array, -1, 0, 0)

;__ArrayPop Function
MsgBox(48, "Array 2D Pop return value ", __ArrayPop($B_Array))
_ArrayDisplay($B_Array, "$avArray AFTER _ArrayPop()")

MsgBox(48, '_Array 1D Pop return value', __ArrayPop($C_Array))
_ArrayDisplay($C_Array, "$avArray AFTER _ArrayPop()")


;__ArrayExtractExact Function
$ArrayExtract = __ArrayExtractExact($B_Array, 0, 3, 0, 1)
_ArrayDisplay($ArrayExtract, "Array Extract 2D array")

$ArrayExtract = __ArrayExtractExact($avArray, 8, 3, 0, 0)
If IsArray($ArrayExtract) Then
   _ArrayDisplay($ArrayExtract, "Array Extract 1D array")
Else
   MsgBox(48, "ArrayExtract 1D array", $ArrayExtract)
EndIf

;ArrayisEmpty function
Local $avArray[10] = ["Debut", "Bonjour", "Bonsoir", "", "Le jour", "La nuit", "Une Journée", "", "Un", "AutoIt"]
Local $B_Array = [["", "B", "C", "D"], ["", "A", "3", ""], ["", "F", "A", "H"], ["5", "6", "", "A"], ["", "J", "K", "Under Last_A or Start"]]
Local $aArrayEmpty = __ArrayIsEmpty($B_Array, -1, -1)

If IsArray($aArrayEmpty) Then
   _ArrayDisplay($aArrayEmpty, "Les Zones vides dans le tableaux 2D[Lignes-Colonnes]")
Else
   MsgBox(48, "Les Zones vides dans le tableaux 2D [Lignes-Colonnes]", $aArrayEmpty)
EndIf

$aArrayEmpty = __ArrayIsEmpty($avArray, -1, -1)
If IsArray($aArrayEmpty) Then
   _ArrayDisplay($aArrayEmpty, "Les Zones vides dans le tableaux 1D[Lignes]")
Else
   MsgBox(48, "Les Zones vides dans le tableaux 1D [Lignes]", $aArrayEmpty)
EndIf

$aArrayEmpty = __ArrayIsEmpty($avArray, 0, 0)
If IsArray($aArrayEmpty) Then
   _ArrayDisplay($aArrayEmpty, "On cherche a savoir si la rangée [0] du tableau est vide")
Else
   MsgBox(48, "On cherche a savoir si la rangée [0] du tableau est vide", $aArrayEmpty)
EndIf

$aArrayEmpty = __ArrayIsEmpty($avArray, 1)
If IsArray($aArrayEmpty) Then
   _ArrayDisplay($aArrayEmpty, "On cherche a savoir si la rangée [1] du tableau est vide")
Else
   MsgBox(48, "On cherche a savoir si la rangée [1] du tableau est vide", $aArrayEmpty)
EndIf

$aArrayEmpty = __ArrayIsEmpty($B_Array, -1, 0)
If IsArray($aArrayEmpty) Then
   _ArrayDisplay($aArrayEmpty, "On cherche a savoir toutes les lignes pour lesquelles la colonne =  0 du tableau est vide")
Else
   MsgBox(48, "On cherche a savoir si pour toutes les lignes pour lesquelles la colonne =  0 du tableau est vide", $aArrayEmpty)
EndIf

Local $aArrayPopReverse = __ArrayPopReverse($avArray)
If IsArray($B_Array) Then
   _ArrayDisplay($B_Array, "On cherche a savoir toutes les lignes pour lesquelles la colonne =  0 du tableau est vide")
EndIf
MsgBox(48, "On cherche a savoir si pour toutes les lignes pour lesquelles la colonne =  0 du tableau est vide", $aArrayPopReverse)

$aArrayPopReverse = __aArrayOwnerIndex($B_Array, -1,-1)
_ArrayDisplay($aArrayPopReverse,"Index")

; #Function# ===========================================================================================================
; Name ..........: __ArrayIsEmpty
; Description ...: Cherche les zones vides dans un tableau 1D ou 2D
; Syntax ........: __ArrayIsEmpty(Byref $aArray[, $aRow = -1[, $aCol = -1]])
; Parameters ....: $aArray              - [in/out] an array of unknowns.
;                  $aRow                - [optional] an array of unknowns. Default is -1.
;                  $aCol                - [optional] an array of unknowns. Default is -1.
; Return values .: Un Tabeau de toutes les zone vides ou simplement les coordonnée de la seule zone vide ou encore false
; Author ........: Numeric
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __ArrayIsEmpty(ByRef $aArray, $aRow = -1, $aCol = -1)
   If Not IsArray($aArray) Then Return SetError(1, 0, -1)

   Local Const $WinAPI_DataSepChar = Opt("GUIDataSeparatorChar"), $SpecDel = " __ "
   Local $RowsUBound = UBound($aArray, $UBOUND_ROWS), $ColsUBound = UBound($aArray, $UBOUND_COLUMNS), _
         $GetEmpty[$RowsUBound][$ColsUBound], $DimsUBound = UBound($aArray, $UBOUND_DIMENSIONS), $Mark_I = -1
   Local $aNewArray[$RowsUBound ^ $ColsUBound][2], $NextROW = -1

   If $aRow > $RowsUBound - 1 Then Return SetError(2, 0, -2)
   If $DimsUBound = 1 Then $aCol = 0
   If $aCol > UBound($aArray, $UBOUND_COLUMNS) Then Return SetError(3, 0, -3)
   Switch $DimsUBound
      Case 1
         ReDim $aNewArray[$RowsUBound][1]
         If $aRow = -1 Then
            For $j = 0 To $RowsUBound - 1
               If Not $aArray[$j] Then
                  $NextROW += 1
                  $aNewArray[$NextROW][0] = $j
               EndIf
            Next
            ReDim $aNewArray[$NextROW + 1][1]
         Else
            If Not $aArray[$aRow] Then $aNewArray[0][0] = $aRow
            ReDim $aNewArray[1][1]
         EndIf
      Case 2
         If $aRow = -1 And $aCol = -1 Then
            For $j = 0 To $RowsUBound - 1
               For $i = 0 To $ColsUBound - 1
                  If Not $aArray[$j][$i] Then
                     $NextROW += 1
                     $aNewArray[$NextROW][0] = $j
                     $aNewArray[$NextROW][1] = $i
                  EndIf
               Next
            Next
            ReDim $aNewArray[$NextROW + 1][2]
         ElseIf $aRow = -1 And $aCol <> -1 Then
            For $g = 0 To $RowsUBound - 1
               If Not $aArray[$g][$aCol] Then
                  $NextROW += 1
                  $aNewArray[$NextROW][0] = $g
                  $aNewArray[$NextROW][1] = $aCol
               EndIf
            Next
            ReDim $aNewArray[$NextROW + 1][2]
         ElseIf $aRow <> -1 And $aCol = -1 Then
            For $h = 0 To $ColsUBound - 1
               If Not $aArray[$aRow][$h] Then
                  $NextROW += 1
                  $aNewArray[$NextROW][0] = $aRow
                  $aNewArray[$NextROW][1] = $h
               EndIf
            Next
            ReDim $aNewArray[$NextROW + 1][2]
         ElseIf $aRow <> -1 And $aCol <> -1 Then
            If Not $aArray[$aRow][$aCol] Then
               $NextROW += 0
               $aNewArray[$NextROW][0] = $aRow
               $aNewArray[$NextROW][1] = $aCol
            EndIf
            ReDim $aNewArray[$NextROW + 1][2]
         EndIf
   EndSwitch
   If Not UBound($aNewArray) Then
      Return SetError(2, 0, "Not Ubound")
   Else
      Return $aNewArray
   EndIf
EndFunc   ;==>__ArrayIsEmpty



; #FUNCTION# ===========================================================================================================
; Name ..........: __ArrayExtractExact
; Description ...: Extrait les elements d'un tableau 2D en Taillant ce dernier à une Adresse Precise
; Syntax ........: __ArrayExtractExact(Byref $aArray[, $iRow = -1[, $eRow = -1[, $iCol = 0[, $eCol = 1]]]])
; Parameters ....: $aArray              - [in/out] an array of unknowns.
;                  $iRow                - [optional] an integer value. Default is -1.
;                  $eRow                - [optional] an unknown value. Default is -1.
;                  $iCol                - [optional] an integer value. Default is 0.
;                  $eCol                - [optional] an array of unknowns. Default is 1.
; Return values .: Succès = Un tableau contenant les valeurs contenues dans les adresses de recherche
;                : Echec =
;                : -1 si $aArray n'est pas un tableau
;                : -2 si la dimension du tableau depasse 2
;                : -3 si la première ligne de recherche depasse le nombre total de lignes du tableau
;                : -4 si la dernière ligne de recherche depasse le nombre total de lignes du tableau
;                : -5 si la première colonne de recherche depasse le nombre total de colonnes du tableau
;                : -6 si la dernière colonne de recherche depasse le nombre total de colonnes du tableau
; Author ........: Numeric
; Modified ......:
; Remarks .......: Limites : La fonction n'est valable que pour les Tableaux à deux dimensions uniquement
; Related .......: _ArrayExtract amelioré: Sans les intervalles de differences entre les lignes ni entre les colonnes
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func __ArrayExtractExact(ByRef $aArray, $iRow = -1, $eRow = -1, $iCol = 0, $eCol = 1)

   If Not IsArray($aArray) Then Return SetError(7, 0, -1)
   ;If UBound($aArray, $UBOUND_DIMENSIONS) > 2 Then Return SetError(-6, 0, -2)
   ;Ubounds Variables
   Local $RowsUBound = UBound($aArray, $UBOUND_ROWS), $ColsUBound = UBound($aArray, $UBOUND_COLUMNS), $DimsUBound = UBound($aArray, $UBOUND_DIMENSIONS)

   ;Colomns must be numbers
   $iCol = (IsNumber($iCol) = 1) ? ($iCol) : 0
   $eCol = (IsNumber($eCol) = 1) ? ($eCol) : 0

   ;Rows must be numbers
   $iRow = (IsNumber($iRow) = 1) ? ($iRow) : 0
   $eRow = (IsNumber($eRow) = 1) ? ($eRow) : $RowsUBound - 1

   If $iRow = -1 Or $iRow = "Default" Then
      $iRow = 0
   ElseIf $iRow > $RowsUBound Then
      Return SetError(-6, 0, -3); Line number > Ubound(Rows)
   EndIf

   If $eRow = -1 Or $eRow = "Default" Then
      $eRow = $RowsUBound - 1
   ElseIf $eRow > $RowsUBound Or $eRow < -1 Then
      Return SetError(-5, 0, -4); ""
   EndIf

   If $iCol = -1 Or $iCol = "Default" Then
      $iCol = 0
   ElseIf $iCol > $ColsUBound Or $iCol < -1 Then
      Return SetError(-4, 0, -5)
   EndIf

   If $eCol = -1 Or $eCol = "Default" Then
      $eCol = $ColsUBound - 1
   ElseIf $eCol > $ColsUBound Or $eCol < -1 Then
      Return SetError(-3, 0, -6)
   EndIf
   Local $avArray = $aArray
   Switch $DimsUBound
      Case 1
         Local $iNext = -1
         If $iRow < $eRow Then
            For $aCount = $iRow To $eRow Step 1
               $iNext += 1
               $avArray[$iNext] = $aArray[$aCount]
            Next
            ReDim $avArray[$iNext + 1]
         Else
            _ArrayReverse($aArray, $eRow, $iRow)
            For $aCount = $eRow To $iRow Step 1
               $iNext += 1
               $avArray[$iNext] = $aArray[$aCount]
            Next
            ReDim $avArray[$iNext + 1]
         EndIf
         Return $avArray
      Case 2
         Local $aNewArray[$RowsUBound][2], $aNext = -1

         If ($iRow = 0) And ($eRow = $RowsUBound - 1) Then
            For $j = 0 To $RowsUBound - 1
               $aNext += 1
               $aNewArray[$aNext][0] = $aArray[$j][$iCol]
               $aNewArray[$aNext][1] = $aArray[$j][$eCol]
            Next
         Else
            $aNewArray[0][0] = $aArray[$iRow][$iCol]
            $aNewArray[0][1] = $aArray[$iRow][$eCol]
            $aNewArray[1][0] = $aArray[$eRow][$iCol]
            $aNewArray[1][1] = $aArray[$eRow][$eCol]
            ReDim $aNewArray[2][2]
         EndIf
         Return $aNewArray
   EndSwitch
EndFunc   ;==>__ArrayExtractExact

; #FUNCTON# ===========================================================================================================
; Name ..........: __ArraySearchExact
; Description ...: cherche et donne toutes les coordonnées (Rows-Colomn) d'une valeur precise dans un tableau 1D ou 2D
; Syntax ........: __ArraySearchExact(Byref $aArray, $iValue[, $aCase = 0])
; Parameters ....: $aArray              - [in/out] an array of unknowns.
;                  $iValue              - an integer value. la valeur dont la fonction cherche les coordonnées
;                  $aCase               - [optional] an array of unknowns. Default is 0.
; Return values .: -1 si $aArray 'est pas un tableau
; Author ........: Numeric
; Modified ......:
; Remarks .......:
; Related .......: _ArraySearch()
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func __ArraySearchExact(ByRef $aArray, $iValue, $aCase = 0)
   If Not IsArray($aArray) Then Return SetError(@error, 0, -1)
   $iValue = (IsString($iValue) = 1) ? ($iValue) : (String($iValue))
   Local $ColsUBound = UBound($aArray, $UBOUND_COLUMNS), $RowsUBound = UBound($aArray, $UBOUND_ROWS), _
         $DimsUBound = UBound($aArray, $UBOUND_DIMENSIONS), $sKey = False, $iRet[$RowsUBound + 1][2], $aNext = -1
   If $DimsUBound > 1 Then
      $sKey = True
   EndIf

   If $sKey Then
      For $i = 0 To $RowsUBound - 1
         For $j = 0 To $ColsUBound - 1
            If StringCompare(String($aArray[$i][$j]), $iValue, $aCase) = 0 Then
               $aNext += 1
               $iRet[$aNext][0] = $i
               $iRet[$aNext][1] = $j
            EndIf
         Next
      Next
      ReDim $iRet[$aNext + 1][2]
   Else
      For $k = 0 To $RowsUBound - 1
         If StringCompare(String($aArray[$k]), $iValue, $aCase) = 0 Then
            $aNext += 1
            $iRet[$aNext][0] = $k
            $iRet[$aNext][1] = $k
         EndIf
      Next
      ReDim $iRet[$aNext + 1][1];[UBound($iRet,$UBOUND_COLUMNS)+1]
   EndIf
   Return $iRet
EndFunc   ;==>__ArraySearchExact

; #FUNCTION# ===========================================================================================================
; Name ..........: __ArrayIsNotEmpty
; Description ...: Remplace tous les zones vides d'un tableau 1D ou 2D
; Syntax ........: __ArrayIsNotEmpty(Byref $aArray)
; Parameters ....: $aArray              - [in/out] an array of unknowns.
; Return values .: Tableau remplit ou -1 si aArray n'est pas un tableau
; Author ........: Numeric
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func __ArrayIsNotEmpty(ByRef $aArray)
   If Not IsArray($aArray) Then Return SetError(@error, 0, -1)
   Local $RowsUBound = UBound($aArray, $UBOUND_ROWS), $ColsUBound = _
         UBound($aArray, $UBOUND_COLUMNS), $DimsUBound = UBound($aArray, $UBOUND_DIMENSIONS)
   Local Const $isMarked = "*"
   If $DimsUBound = 1 Then
      For $j = 0 To UBound($aArray) - 1
         If _ArraySearch($aArray, "") <> -1 And @error = 0 Then
            _ArrayDelete($aArray, _ArraySearch($aArray, ""))
         EndIf
      Next
   ElseIf $DimsUBound = 2 Then
      For $i = 0 To $RowsUBound - 1
         For $k = 0 To $ColsUBound - 1
            $aArray[$i][$k] = ($aArray[$i][$k] = "") ? ($isMarked) : ($aArray[$i][$k])
         Next
      Next
   EndIf
   Return $aArray
EndFunc   ;==>__ArrayIsNotEmpty

; #FUNCTION# ===========================================================================================================
; Name ..........: __ArrayReplaceInRange
; Description ...: Remplace dans un tableau 1D ou 2D une valeur par une Autre
; Syntax ........: __ArrayReplaceInRange(Byref $aArray[, $iValue = ""[, $RepValue = "*"[, $aCase = 0]]])
; Parameters ....: $aArray              - [in/out] an array of unknowns. Le Tableau
;                  $iValue              - [optional] Default is "". La valeur à remplacer dans le tableau
;                  $RepValue            - [optional] an unknown value. Default is "*". La valeur par laquelle remplacer $iValue.
;                  $aCase               - [optional] . Default is 0.
; Return values .: Le tableau traité. ou -1 si $aArray n'est pas un tableau.
; Author ........: Numeric
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func __ArrayReplaceInRange(ByRef $aArray, $iValue = "", $RepValue = "*", $aCase = 0)
   If Not IsArray($aArray) Then Return SetError(@error, 0, -1)
   Local $RowsUBound = UBound($aArray, $UBOUND_ROWS), $ColsUBound = _
         UBound($aArray, $UBOUND_COLUMNS), $DimsUBound = UBound($aArray, $UBOUND_DIMENSIONS)
   If $DimsUBound = 1 Then
      For $j = 0 To $RowsUBound - 1
         $aArray[$j] = (StringCompare(String($aArray[$j]), String($iValue), $aCase) = 0) ? (String($RepValue)) : ($aArray[$j])
      Next
   ElseIf $DimsUBound = 2 Then
      For $i = 0 To $RowsUBound - 1
         For $k = 0 To $ColsUBound - 1
            $aArray[$i][$k] = (StringCompare(String($aArray[$i][$k]), String($iValue), $aCase) = 0) ? (String($RepValue)) : ($aArray[$i][$k])
         Next
      Next
   EndIf
   Return $aArray
EndFunc   ;==>__ArrayReplaceInRange


; #FUNCTIONS# ===========================================================================================================
; Name ..........: __ArrayReverse
; Description ...: Renverse l'ordre de chaque element d'un taleau 1D ou 2D
; Syntax ........: __ArrayReverse(Byref $aArray[, $aColNum = 0[, $iStart = 0[, $iEnd = 0]]])
; Parameters ....: $aArray              - [in/out] le tableau dans lequel renverser l'ordre des éléments.
;                  $aColNum             - [optional] . Default is 0. La colonne dont l'ordre des éléments sera renversé
;                  $iStart              - [optional] an integer value. Default is 0. l'index du debut de renversement d'ordre des éléments
;                  $iEnd                - [optional] an integer value. Default is 0. l'index de la fin de renversement d'ordre.
; Return values .: Succès = Le Tableau avec le nouvel ordre de stockage des éléments|Echec :
;                : @error <> 0
;                : @error = 1 $aArray n'est pas un tableau
;                : @error = 2 $iStart > $iEnd
;                : @error = 3 $aArray n'est pas un tableau 1D ou 2D
;                : @error = 4 $aArray (le tableau)  est vide
;                : @error = 5 l'index de la colonne dans laquelle renverser l'ordre des éléménts est superieur à l'index de la dernière colonne du tableau.
; Author ........: Numeric
; Modified ......: Pris en charge des tableaux 2D et Precision de la colonne dans laquelle renverser l'ordre.
; Remarks .......:
; Related .......: _ArrayReverse()
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func __ArrayReverse(ByRef $aArray, $aColNum = 0, $iStart = 0, $iEnd = 0)

   If $iStart = Default Then $iStart = 0
   If $iEnd = Default Then $iEnd = 0
   If Not IsArray($aArray) Then Return SetError(1, 0, 0)
   If Not UBound($aArray) Then Return SetError(4, 0, 0)

   Local $RowsUBound = UBound($aArray, $UBOUND_ROWS) - 1, $ColsUBound = _
         UBound($aArray, $UBOUND_COLUMNS), $DimsUBound = UBound($aArray, $UBOUND_DIMENSIONS)

   ; Bounds checking
   If $iEnd < 1 Or $iEnd > $RowsUBound Then $iEnd = $RowsUBound
   If $iStart < 0 Then $iStart = 0
   If $iStart > $iEnd Then Return SetError(2, 0, 0)
   If $aColNum = Default Then $aColNum = 0
   $aColNum = (IsNumber($aColNum) = 1) ? ($aColNum) : (Number($aColNum))
   If $aColNum > $ColsUBound Then Return SetError(5, 0, 0)


   Local $vTmp, $Marked = $iEnd
   If $DimsUBound = 1 Then
      For $i = $iStart To Int(($iStart + $iEnd - 1) / 2)
         $vTmp = $aArray[$i]
         $aArray[$i] = $aArray[$iEnd]
         $aArray[$iEnd] = $vTmp
         $iEnd -= 1
      Next
   ElseIf $DimsUBound = 2 Then
      If $aColNum <> -1 Then
         For $i = $iStart To Int(($iStart + $iEnd - 1) / 2)
            $vTmp = $aArray[$i][$aColNum]
            $aArray[$i][$aColNum] = $aArray[$iEnd][$aColNum]
            $aArray[$iEnd][$aColNum] = $vTmp
            $iEnd -= 1
         Next
      ElseIf $aColNum = -1 Then
         For $b = 0 To $ColsUBound - 1
            $iEnd = $Marked
            For $i = $iStart To Int(($iStart + $iEnd - 1) / 2)
               $vTmp = $aArray[$i][$b]
               $aArray[$i][$b] = $aArray[$iEnd][$b]
               $aArray[$iEnd][$b] = $vTmp
               $iEnd -= 1
            Next
         Next
      EndIf
   Else
      Return SetError(3, 0, 0); array is not an 1D or 2D array
   EndIf
   Return $aArray
EndFunc   ;==>__ArrayReverse


; #FUNCTION# ===========================================================================================================
; Name ..........: __ArrayPop
; Description ...: Retourne le dernier élément d'un Array 1D ou 2D en supprimant ce dernier
; Syntax ........: __ArrayPop(Byref $aArray)
; Parameters ....: $aArray              - [in/out] an array of unknowns.
; Return values .: echec: @error = 1 si $aArray n'est pas un tableau| @error = 2 si $aArray n'est pas un tableau 1D ou 2D
; Author ........: Numeric
; Modified ......:
; Remarks .......:
; Related .......: _ArrayPop()
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func __ArrayPop(ByRef $aArray)
   If (Not IsArray($aArray)) Then Return SetError(1, 0, "")
   Local $iUBound = UBound($aArray, $UBOUND_ROWS) - 1
   Local $ColsUBound = UBound($aArray, $UBOUND_COLUMNS) - 1
   Local $sLastVal, $DimsUBound = UBound($aArray, $UBOUND_DIMENSIONS)

   If $iUBound = -1 Then Return SetError(3, 0, "")
   If ($DimsUBound <> 1) And ($ColsUBound = -1) Then Return SetError(4, 0, "")

   Switch $DimsUBound
      Case 1
         $sLastVal = $aArray[$iUBound]
         If $iUBound > -1 Then
            ReDim $aArray[$iUBound]
         EndIf
      Case 2
         $sLastVal = $aArray[$iUBound][$ColsUBound]
         If $iUBound > -1 And $ColsUBound > -1 Then
            ReDim $aArray[$iUBound][$ColsUBound]
         EndIf
      Case Else
         Return SetError(2, 0, "")
   EndSwitch
   Return $sLastVal
EndFunc   ;==>__ArrayPop


; #Function# ===========================================================================================================
; Name ..........: __ArrayPopReverse
; Description ...: Retourne le premier élément d'un Array 1D ou 2D en supprimant ce dernier
; Syntax ........: __ArrayPopReverse(Byref $aArray)
; Parameters ....: $aArray              - [in/out] an array of unknowns.
; Return values .: echec: @error = 1 si $aArray n'est pas un tableau| @error = 2 si le tableau ne comporte plus de lignes
;                : @error = 3 si le taleau 2D ne comporte Plus de colonne| @error = 4 si le tableau n'est pas de 1D ou 2D
; Author ........: Numeric
; Modified ......:
; Remarks .......:
; Related .......: 1/__ArrayPop()
; Link ..........:
; Example .......: yes
; ===============================================================================================================================
Func __ArrayPopReverse(ByRef $aArray)
   If Not IsArray($aArray) Then Return SetError(1, 0, "")
   Local $sLastVal
   Local $RowsUBound = UBound($aArray, $UBOUND_ROWS), $ColsUBound = _
         UBound($aArray, $RowsUBound), $DimsUBound = UBound($aArray, $UBOUND_DIMENSIONS)
   Local $iUBound = $RowsUBound - $RowsUBound
   Local $jUBound = $ColsUBound - $ColsUBound

   If $iUBound = -1 Then Return SetError(2, 0, "")
   If ($DimsUBound <> 1) And ($jUBound = -1) Then Return SetError(3, 0, "")
   Switch $DimsUBound
      Case 1
         $sLastVal = $aArray[$iUBound]
         If $iUBound > -1 Then
            ReDim $aArray[$iUBound]
         EndIf
      Case 2
         $sLastVal = $aArray[$iUBound][$jUBound]
         If $iUBound > -1 And $jUBound > -1 Then
            ReDim $aArray[$iUBound][$jUBound]
         EndIf
      Case Else
         Return SetError(4, 0, "")
   EndSwitch
   Return $sLastVal
EndFunc   ;==>__ArrayPopReverse



; #FUNCTION# ===========================================================================================================
; Name ..........: __aArrayOwnerIndex
; Description ...:  Retourne l'index du Tableau
; Syntax ........: __aArrayOwnerIndex(Byref $aArray)
; Parameters ....: $aArray              - [in/out] an array of unknowns.
; Return values .: tableau avec pour valeurs les index
; Author ........: Numeric
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: yes
; ===============================================================================================================================
Func __aArrayOwnerIndex(ByRef $aArray, $iIndex = -1, $aColIndex = -1)

   Local Const $WinAPI_DataSepChar = Opt("GUIDataSeparatorChar")
   If IsArray($aArray) Then
      Switch UBound($aArray, $UBOUND_DIMENSIONS)
         Case 1
            If $iIndex = -1 Then
               For $j = 0 To UBound($aArray, $UBOUND_ROWS) - 1
                  $aArray[$j] = $j
               Next
            Else
               $aArray[$iIndex] = $iIndex
            EndIf
         Case 2
            If $iIndex = -1 And $aColIndex = -1 Then
               For $i = 0 To UBound($aArray, $UBOUND_ROWS) - 1
                  For $v = 0 To UBound($aArray, $UBOUND_COLUMNS) - 1
                     $aArray[$i][$v] = $i & $WinAPI_DataSepChar & $v
                  Next
               Next
            ElseIf ($iIndex = -1) And ($aColIndex <> -1) Then
               For $w = 0 To UBound($aArray) - 1
                  $aArray[$w][$aColIndex] = $w & $WinAPI_DataSepChar & $aColIndex
               Next
            ElseIf $iIndex <> -1 And $aColIndex = -1 Then
               For $aRound = 0 To UBound($aArray, $UBOUND_COLUMNS) - 1
                  $aArray[$iIndex][$aRound] = $iIndex & $WinAPI_DataSepChar & $aRound
               Next
            ElseIf $iIndex <> -1 And $aColIndex <> -1 Then
               $aArray[$iIndex][$aColIndex] = $iIndex & $WinAPI_DataSepChar & $aColIndex
            EndIf
      EndSwitch
      Return $aArray
   EndIf
   Return ""
EndFunc   ;==>__aArrayOwnerIndex
De 0 et 1 vers les étoiles , tout part du Binaire, Numeric
Répondre