danny1878 Posted December 24, 2009 Posted December 24, 2009 (edited) Hi guys, can you help me out a bit here? I have an $arrayx[10][11] $arrayx[6][11] = "h2o" I tried to search what row that has "h2o" but failed, so I make a simple test a "2d" array first #include <Array.au3> Local $avArray[6][2] = [ _ ["String0", "am2"], _ ["String1", "am6"], _ ["String2", "am9"], _ ["String3", "am4"], _ ["String4", "hail"], _ ["String5", "am3"]] $sSearch = InputBox("_ArraySearch() demo", "String to find?") If @error Then Exit For $i=0 to 3 ;-- ignore this, cuz maybe I got it upside down $iIndex = _ArraySearch($avArray, $sSearch, 0, 0, 0, 0, $i) If @error Then MsgBox(0, "Not Found", '"' & $sSearch & '" was not found on column ' & $i & '.') Else MsgBox(0, "Found", '"' & $sSearch & '" was found in the array at position ' & $iIndex & ' on column ' & $i & '.') EndIf Next The result "am4" is nowhere to be found, is this correct? Edited December 24, 2009 by danny1878
Authenticity Posted December 24, 2009 Posted December 24, 2009 The seventh parameter is $iForward not the $iSubItem to check. Perhaps you've meant: $iIndex = _ArraySearch($avArray, $sSearch, 0, 0, 0, 0, 1, 1) ..the it's assumed the you know which column it's on because you've search in that column, it only returns the row index.
danny1878 Posted December 24, 2009 Author Posted December 24, 2009 Thanks for replying, I appreciate it.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now