supersonic Posted February 20, 2009 Share Posted February 20, 2009 (edited) Hi! When comparing different values with StringCompare() I got the following results: StringCompare("98", "99") = -1 (OK.) StringCompare("99", "98") = 1 (OK.) StringCompare("99", "99") = 0 (OK.) StringCompare("100", "99") = -1 (Shouldn't it be "1"?) StringCompare("150", "99") = -1 (Shouldn't it be "1"?) Same behaviour when using "If": If $aVal1[$j] > $aVal2[$j] Then Return 1 ElseIf $aVal1[$j] < $aVal2[$j] Then Return -1 EndIf Any ideas? Greets, -supersonic. Edited February 20, 2009 by supersonic Link to comment Share on other sites More sharing options...
TerarinK Posted February 20, 2009 Share Posted February 20, 2009 Your firstly using a string to compare these values. so by default 0 would be the losest and 9 the highest. so you need to implement the true case in here. StringCompare("100","099") = 1 However your using numericals so you should call a another function. Need a function that turns the numerical into digits and do the calculation when I get home tonight unless you will create it 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
supersonic Posted February 20, 2009 Author Share Posted February 20, 2009 You're right! Using the function Number() will solve my issue.Your firstly using a string to compare these values. so by default 0 would be the losest and 9 the highest. so you need to implement the true case in here.StringCompare("100","099") = 1However your using numericals so you should call a another function. Need a function that turns the numerical into digits and do the calculation when I get home tonight unless you will create it Link to comment Share on other sites More sharing options...
TerarinK Posted February 20, 2009 Share Posted February 20, 2009 Yes, I could say Binary(), Dec(), Hex() or Number() could work too. Just enclose the numericals in them and your off 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E 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