sandyd Posted October 2, 2006 Share Posted October 2, 2006 Hi all,Having a bit of a problem getting my head round array. See the following code:#include <file.au3> #include <Array.au3> Dim $WordList, $As[1] _FileReadToArray('a.txt',$WordList) For $i = 1 To $WordList[0] If StringLower(StringLeft($WordList[$i],3)) = 'add' Then _ArrayAdd($As,$WordList[$i]) Next _ArrayDisplay($As,'ADD ...') MsgBox(0,'',$As[0])A file with lots of words begining with the letter A is read. I then try to filter them down by searching for the first 3 letters to be add. When I try to display the results, it cant determine the number of items in the array. I have checked by outputting $As[0] which shows blank.Any ideas? ----[ SandyD ]--- Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 2, 2006 Moderators Share Posted October 2, 2006 Hi all, Having a bit of a problem getting my head round array. See the following code: #include <file.au3> #include <Array.au3> Dim $WordList, $As[1] _FileReadToArray('a.txt',$WordList) For $i = 1 To $WordList[0] If StringLower(StringLeft($WordList[$i],3)) = 'add' Then _ArrayAdd($As,$WordList[$i]) Next _ArrayDisplay($As,'ADD ...') MsgBox(0,'',$As[0]) A file with lots of words begining with the letter A is read. I then try to filter them down by searching for the first 3 letters to be add. When I try to display the results, it cant determine the number of items in the array. I have checked by outputting $As[0] which shows blank. Any ideas?If the msgbox is not there, then you probably have too much information to display... Use Ubound($As) - 1 instead of $As[0] and see what you get Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
xcal Posted October 2, 2006 Share Posted October 2, 2006 Hi all, Having a bit of a problem getting my head round array. See the following code: #include <file.au3> #include <Array.au3> Dim $WordList, $As[1] _FileReadToArray('a.txt',$WordList) For $i = 1 To $WordList[0] If StringLower(StringLeft($WordList[$i],3)) = 'add' Then _ArrayAdd($As,$WordList[$i]) Next _ArrayDisplay($As,'ADD ...') MsgBox(0,'',$As[0]) oÝ÷ Øâì"¶h¶ÊÂݱ· x§Ø^ëmz°"²·taz{kÊÚ[^®Ø^Ú0¼¬yªÜ)à~íçâ®Ëwëmz»-¡·¢Z+£}úé÷쥩ì·)^ How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
sandyd Posted October 2, 2006 Author Share Posted October 2, 2006 Cheers for the replies, I think I'll stick with UBound, more generic and less for me to worry about. ----[ SandyD ]--- Link to comment Share on other sites More sharing options...
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