DarkNecromancer Posted September 9, 2004 Posted September 9, 2004 (edited) hay i was making a program installer and i want my program to convert a string to an array. so i made a while loop to move each individual character over but i get a strange error:For $e = 0 To 15 Local $thekey[$e] = StringLeft ( $key, 1) $len = StringLen ( $key) $key = StringRight ( $key, ($len - 1)) Next and i get the error: Local $thekey[$e]= StringLeft ( $key, 1) Local $thekey[^ ERROR Error: Array variable subscript badly formatted. I've gone over the help file and i can't see any varient in my version from the one provided in the help file Edited September 9, 2004 by DarkNecromancer
Matt @ MPCS Posted September 9, 2004 Posted September 9, 2004 Try using the following instead: Dim $thekey ; The delimiter is a null string $thekey = StringSplit( $key, "" ) Per the StringSplit() documentation: If you use a blank string "" for the delimiters, each character will be returned as an element.It should do what you are talking about. If you really think you need to do a loop then do not declare the array inside the loop. Try this: Dim $e Dim $thekey[StringLen($key)] For $e = 0 to ( UBound($thekey) - 1 ) $thekey[$e] = StringMid( $key, ($e + 1), 1) Next Both code segments have been tested and work. I hope this is what you are looking for, Happy Posting! *** Matt @ MPCS
DarkNecromancer Posted September 9, 2004 Author Posted September 9, 2004 OOoO thanks, didn't see that Still learning all the commands of V3 :\
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