I have this code which outputs each for loop iteration result into a message box:
dim str
str = inputbox("Please enter character string for encryption","Encryption")
for i=1 to len(str)
wscript.echo asc(mid(str,i,1)) - (i-1)
next
I would like to store each iteration result into an array, and then display the full array content in a message box as a string.
I'm trying something like this:
dim str, arr()
str = inputbox("Please enter character string for encryption","Encryption")
for i=1 to len(str)
redim preserve arr(ubound(arr)+1)
arr(ubound(arr)) = asc(mid(str,i,1)) - (i-1)
next
wscript.echo arr
but get Line 6: Error: subscript out of range 'ubound'. Should I be calling the iteration through a function, before mapping it to an array?