A suggestion, this is an efficiency bit to avoid re-evaluting math expressions and such in the for loop.
theUsual's code:
function strToArray(word$)
//Getting word length
length = len(word$) - 1
//Converting string to character array
dim ar[length] as string
for i = 0 to length
ar[i] = mid(word$, i+1, 1)
next i
endfunction ar
okee's code:
function strToArray(word$)
ar as string[]
wl = len(word$) - 1
for i = 0 to wl
ar.insert(mid(word$, i+1, 1))
next i
endfunction ar
theUsual's code is actually probably the one that would execute faster. It predefines the array size and then just sets values.
okee's code requires a function call (ar.insert) each loop. That call has to resize the array each time in order to add the new element. Each resize operation does a memory allocation for the new size, copies the existing values from the old array, stores the new value and then (hopefully) clears the memory for the old array.
But, it is a bit more 'elegant'.
Cheers,
Ancient Lady