AGlassman Posted May 10, 2008 Share Posted May 10, 2008 I was under the assumtion that _ArraySort sorted in ASCII order, so I can not explain the following: CODE #include <Array.au3> Dim $a[5] = ["z" , "!" , "#" , "+" , "^" ] _ArrayDisplay( $a ) _ArraySort( $a ) _ArrayDisplay( $a ) Which, after the _ArraySort outputs: [0]|! [1]|# [2]|^ [3]|+ [4]|z But the "^" seems out of place since ASC("#")=35, ASC("^")=94, and ASC("+")=43. I've tried wrapping the values in String(), using multi-char strings, etc. But the "^" keeps sorting out ahead of the "+". I'm using a sorted array that contains "^..." strings in an _ArrayBinarySearch and I'm concerned that it might start failing in the future since the sort order doesn't appear correct. I'm certain it's something I don't understand about AutoIt, but any explanation or advice would be appreciated. AutoIt v3.2.10.0, XP SP2. Link to comment Share on other sites More sharing options...
Siao Posted May 10, 2008 Share Posted May 10, 2008 (edited) Advice - use this http://www.autoitscript.com/forum/index.php?showtopic=63525 if you want consistent and logical results (not to mention the speed). Although I've noticed it's not fully compatible with AutoIt's string compare - there is issue with underscore (_ < 0, but 1_ > 10) which could be fixed by replacing strcmp/_strcmpi with kernel's lstrcmp/lstrcmpi, but I never cared that much to do it.Bottom line is, if you expect trouble using _ArrayBinarySearch on these chars, then test it, do not assume things like you do now. Are you really sure it will be an issue? In theory both _ArrayBinarySearch and _ArraySort use the same string comparison, so even if the sort order doesn't look very logical, it should match. Edited May 10, 2008 by Siao "be smart, drink your wine" 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