Extrait un tableau à partir d'éléments spécifiés d'un tableau 1D ou 2D
#include <Array.au3>
_ArrayExtract ( Const ByRef $aArray [, $iStart_Row = -1 [, $iEnd_Row = -1 [, $iStart_Col = -1 [, $iEnd_Col = -1]]]] )
$aArray | Tableau où doit se faire l'extraction |
$iStart_Row | [optionnel] Première ligne à extraire |
$iEnd_Row | [optionnel] Dernière ligne à extraire |
$iStart_Col | [optionnel] Première colonne à extraire (2D uniquement) |
$iEnd_Col | [optionnel] Dernière colonne à extraire (2D uniquement) |
Succès: | Retourne le tableau extrait. |
Échec: | Retourne -1 et définit @error <> 0. |
@error: | 1 - $aArray n'est pas un tableau 2 - $aArray n'est pas un tableau 1D ou 2D 3 - $iStart_Row ou $iEnd_Row est en dehors des limites du tableau 4 - $iStart_Row est plus grand que $iEnd_Row 5 - $iStart_Col ou $iEnd_Col est en dehors des limites du tableau 6 - $iStart_Col est plus grand que $iEnd_Col |
#include <Array.au3> Local $aArray[4][4] For $i = 0 To 3 For $j = 0 To 3 $aArray[$i][$j] = String($i) & String($j) Next Next _ArrayDisplay($aArray, "Tableau d'origine") Local $aExtract = _ArrayExtract($aArray, 1, 2, 2, 3) _ArrayDisplay($aExtract, "Lignes 1-2 Colonnes 2-3")