In an AHK_L script (unicode 64-bit) I cannot make sense of the following results taken from a much larger script (and annotated here)
If (NewWindTubes <> RunWinTubes) OutputDebug NOT EQUAL ; Shows as NOT EQUAL even though I believe the strings to be equal If (NewWindTubes = RunWinTubes) OutputDebug ARE EQUAL ; does not show as equal OutputDebug, % StrLen(RunWindTubes) . " " . StrLen(NewWindTubes) ; Shows as 74 74 (i.e. both are 74) asdf := StrLen(RunWindTubes) Loop, %asdf% { AA := SubStr(RunWindTubes, A_Index, 1) BB := SubStr(NewWindTubes, A_Index, 1) If (AA <> BB) OutputDebug, %A_Index% [%AA%][%BB%] ; this never shows If (AA = BB) OutputDebug, %A_Index% [%AA%][%BB%] EQUAL ; this shows 74 equal results } NewWindTubes := "<4> [0 2560 0 1600] [3760 5680 0 1200] [-1200 0 0 1600] [2560 3760 0 1600]" ; the actual data RunWindTubes := "<4> [0 2560 0 1600] [3760 5680 0 1200] [-1200 0 0 1600] [2560 3760 0 1600]" ; the actual data If (NewWindTubes <> RunWinTubes) OutputDebug NOT EQUAL ; shows NOT EQUAL even though the typed values above are identical If (NewWindTubes = RunWinTubes) OutputDebug ARE EQUAL AAA := NewWindTubes BBB := RunWindTubes If (AAA = BBB) OutputDebug ARE EQUAL ; shows ARE EQUAL If (AAA <> BBB) OutputDebug NOT EQUAL Return
What I think I am seeing are equal strings being reported as not equal even though every character in them, on a character by character basis, compares as euqal, and even though, if the strings are assigned to different variables, the different variables compare as equal. But I know I make errors, and do not see them. One of the variables, RunWindTubes, is global; I tried making the other global as well (it had been local) but got the same result. I cannot make them both local, because the strings being compared are captured in different routines at different times.
Any insight?