Hi all,
I have the following code, basically, it populates an array with unique characters found in a string, but it turns out only one character is in the array, i don't want to think it is due to a bug of autoit at this point, so i need your help on why, please
Dim $sx[0]
Dim $cn
$ss = "Xx"
ConsoleWrite(StringLeft($ss, 1) & " " & StringRight($ss, 1) & @CRLF)
ConsoleWrite(StringLeft($ss, 1) = StringRight($ss, 1) & @CRLF) ;here show X <> x
ConsoleWrite(@CRLF)
;the following is to populate array $sx with different unique characters in $ss
For $b = 1 To StringLen($ss)
$flg = 0
For $a = 0 To UBound($sx) - 1
;if asc(StringMid($ss,$b,1)) = asc($sx[$a]) Then ;if this line is used instead of the next, everything is fine
If StringMid($ss, $b, 1) = $sx[$a] Then
If StringMid($ss, $b, 1) = "x" Then ConsoleWrite("<<->>" & StringMid($ss, $b, 1) & " " & $sx[$a] & @CRLF)
$flg = 1
ExitLoop
EndIf
Next
If $flg = 0 Then
$cn = $cn + 1
ReDim $sx[$cn]
$sx[$cn - 1] = StringMid($ss, $b, 1)
EndIf
Next
ConsoleWrite(UBound($sx) & @CRLF);list the ubound of $sx
;list what is in array $sx
For $a = 0 To UBound($sx) - 1
ConsoleWrite($sx[$a] & @CRLF)
Next
same code in a file is attached as uniqueChar2Array.au3