Guillermo Posted February 24, 2006 Share Posted February 24, 2006 (edited) ... obviously, I meant o = O but ó <> Ó ... $a = "si" $b = "SI" If $a = $b Then MsgBox(0, $a & " / " & $b, "They're identical") Else MsgBox(0, $a & " / " & $b, "They're different") EndIf $a = "sí" $b = "SÍ" If $a = $b Then MsgBox(0, $a & " / " & $b, "They're identical") Else MsgBox(0, $a & " / " & $b, "They're different") EndIf I can't understand this. If AutoIT supports ANSI, why are special characters different depending on whether they're in lower or upper case? My script deals with text and has to compare strings constantly, so this is a big issue for me. If I could understand how AutoIT "reads" these characters then I could figure out a solution. Edited February 24, 2006 by Guillermo Link to comment Share on other sites More sharing options...
GaryFrost Posted February 24, 2006 Share Posted February 24, 2006 From the help section Operators= Tests if two values are equal (case insensitive if used with strings). e.g. If $var= 5 Then (true if $var equals 5)== Tests if two values are equal (case sensitive if used with strings) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
andyswarbs Posted February 24, 2006 Share Posted February 24, 2006 If you check the helpfile regarding operators you will see that both = and == can be used for testing strings - but the results may be different. = Tests if two values are equal (case insensitive if used with strings). == Tests if two values are equal (case sensitive if used with strings) Licensing.au3Extended _Max & _Min_MsgBoxExitVarious extensions to _GuiCtrl...Run Dos programs output into an array etc (Updated 19-Feb-06)Extensions to Array library, primarily in two dimensions (updated 20-Feb-06)Version dependency calculator, _IsVer1GEVer2User Management, answering some domain questions (updated 19-Feb-06, various bugfixes and new functions added)Extensions to registry manipulation, including a recursive search & replaceDelimited string library (updated 19-Feb-03, added _DelimListSort)String library extensionsTerminal Server supportFile libraryCommand line parser (added 18-Feb-06)(UDF homepage) (Scit4Au3 UserCallTips added 21-Feb-06) Link to comment Share on other sites More sharing options...
Guillermo Posted February 24, 2006 Author Share Posted February 24, 2006 I didn't make my point...I've read the help file and I know the difference between "=" and "==". However, AutoIT behaves differently when testing extended characters.melon = MELON (true)melon == MELON (false)butmelón = MELÓN (false)melón == MELÓN (false)If you try out the code I pasted in my first post you'll understand what I mean.My question is why. Link to comment Share on other sites More sharing options...
UTA Posted February 24, 2006 Share Posted February 24, 2006 (edited) The simplest solution would be to use following: $a = "si" $b = "SI" If $a = $b Then MsgBox(0, $a & " / " & $b, "They're identical") Else MsgBox(0, $a & " / " & $b, "They're different") EndIf $a = "sí" $b = "SÍ" $c = StringUpper($a) If $b = $c Then MsgBox(0, $a & " / " & $b, "They're identical") Else MsgBox(0, $a & " / " & $b, "They're different") EndIf It's always the best to convert both arguments to the same "level" (Uppercase) before comparing. Then you are more flexible. btw: I do not really know why it's different on special characters, but I mostly convert two strings before I compare them. That's why I never recognized such a problem UTA Edited February 24, 2006 by UTA Link to comment Share on other sites More sharing options...
Guillermo Posted February 24, 2006 Author Share Posted February 24, 2006 Yeah, that's the funny part. After converting the strings to the same level everything works fine... Wouldn't that be a bug? Link to comment Share on other sites More sharing options...
UTA Posted February 24, 2006 Share Posted February 24, 2006 I'm not quite sure if that is a bug. I'm too lazy to test it in another programming language. I suppose that it is a "feature" which is based on the special characters. But as I said: I'm not sure... 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