#include #include #include #AutoIt3Wrapper_Add_Constants=n ;-------------------------------------------------------------------------------------------------------------------------------------- ; ; Examples for _ArrayFindAllex ; ;-------------------------------------------------------------------------------------------------------------------------------------- ; 1D and 2D array for examples Local $av1DTestArray[20] = ['Tom', 'Tina', 'Steve', 'Jim', 'Jack', 'Mark', 'Barbara', 'Paul', 'Daniel', 'Michelle', 'Patrick', 'Michael', 'Alfred', 'albert'] Local $av2DTestArray[20][3] = [ _ ['Car', 'Red', 20000], _ ['dog', 'Fido', 'vicar'], _ ['basketball', 'football', 'soccer'], _ [1, 2, 3], _ ['George', 'Room # 30', 'Math'], _ ['1111 Present Street', 'North Pole', 'Earth'], _ ['Phaw!', 'chortle?', 'gaffaw *'], _ ['pancakes', 'tomatoes', 'carrots'], _ ['car', 'bike', 'skateboard'], _ ['math', 'history', 'biology'] _ ] ; generate table of ascii characters Local $aTmpASCII[256] For $1 = 0 To 255 $aTmpASCII[$1] &= Chr($1) Next Local $out_str ; test for common ascii characters at the end of every element in $av2DTestArray - write output to console For $1 = 33 To 127 - 1 $Ret = _ArrayFindAllex($av2DTestArray, $aTmpASCII[$1], 3) Switch @error Case 0 For $2 = 0 To UBound($Ret) - 1 $out_str &= StringFormat('Search for [ %-1s ] Found at element [ %-10s ] value is [ %-10s ]', $Ret[$2][1], $Ret[$2][0], $Ret[$2][2]) & @LF Next ConsoleWrite($out_str) Case 1 ConsoleWrite('Input source is not an array' & @LF) Case 2 ConsoleWrite('Search type is invalid' & @LF) Case 3 ConsoleWrite('Case sense is invalid' & @LF) Case 4 ConsoleWrite('Input source is not a 1D or 2D array' & @LF) Case 5 ConsoleWrite('[ ' & $aTmpASCII[$1] & ' ] Not Found' & @LF) EndSwitch Next ConsoleWrite('! Test for ASCII chars at the end of 2D array elements' & @LF & $out_str & @LF) ; find all lines in this script that end with the tokens "then", "1" or "@lf" Local $a10 = StringSplit(FileRead(@ScriptName), @CRLF, 3) $Ret = _ArrayFindAllex($a10, 'then##1##@lf', 3, -1, '##') _ArrayDisplay($Ret, 'Script lines ending with "then" or "1" or "@LF') ; find "div" statements in www.autoit.com/forum/ Local $bHTML = InetRead('http://www.autoitscript.com') If @error <> 0 Then ConsoleWrite('inetread failed' & @LF) Local $aHTML = StringSplit(BinaryToString($bHTML), @CRLF, 3) $Ret = _ArrayFindAllex($aHTML, ' 0 Then ConsoleWrite(@error & @LF) _ArrayDisplay($aTest, 'After - Time to delete column = ' & Round(TimerDiff($st) / 1000, 3))