Insolence Posted February 8, 2005 Posted February 8, 2005 Why in the hell does it keep the 0 after I set this: $arCharactersTemp[1][0]="A" returns A0 Seems like a waste to have to do a StringTrimRight for each one... I tried searching but I had no idea what to look for "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Valik Posted February 8, 2005 Posted February 8, 2005 You mind giving a fully working example that demonstrates the problem instead of snippets that don't do anything?
Insolence Posted February 8, 2005 Author Posted February 8, 2005 (edited) Not at all. Dim $arCharactersTemp[63][2] $arCharactersTemp[1][0]="A" $arCharactersTemp[1][1]="0,-1;-1,0;-1,-1;-7,0;-7,-1;" Const $arCharacters = $arCharactersTemp $Test = "0,-1;-1,0;-1,-1;-7,0;-7,-1;" $String = "" For $x = 1 to UBound($arCharacters) - 1 If $arCharacters[$x][1] = $Test Then $String = $String & $arCharacters[$x][0] EndIf Next MsgBox("","", $String) Thought it was a simple matter, no idea I had to post a demo. Edited February 8, 2005 by Insolence "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Valik Posted February 8, 2005 Posted February 8, 2005 Use == to force a string comparison. By default, an unintialized variable (Or array element) is a number 0 with string representation "". The If statement is performing a numerical comparison between 0 (Unitialized array element's default value) and a string, and since strings are 0 when converted to numbers (In this case), the condition is always true, so you are appending the contents every iteration of the loop. This isn't an AutoIt bug but rather its normal behavior for the last several months if not since the beginning.
Insolence Posted February 8, 2005 Author Posted February 8, 2005 That's nuts. Thanks. "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
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