I liked mn's example.
Well, I don't see a function, because we are returning a set of array values, not just a single value; so a sub seems a more likely choice...
Now I think we need to restrict it to dynamic arrays, to avoid a duplicate definition. Maybe this could be expanded on to handle string arrays, too. As far as how to define them by type, single, long, etc. That's more complicated.
Edit: Steve was posting while I was writing. I se the same method.In fact, just recently in my replies to the password thread.
Pete
Well, I don't see a function, because we are returning a set of array values, not just a single value; so a sub seems a more likely choice...
Code: (Select All)
REDIM LNUMS(0): myray LNUMS(), "1, 2, 5, 8, 4000"
FOR i = 1 TO 5
PRINT lNUMS(i)
NEXT
SUB myray (myarray(), myarray_elements AS STRING)
DO
i = i + 1
j = INSTR(seed, myarray_elements + ",", ",")
IF j = 0 THEN EXIT DO
REDIM _PRESERVE myarray(i)
myarray(i) = VAL(MID$(myarray_elements, seed + 1, j - seed - 1))
seed = j + 1
LOOP
END SUB
Now I think we need to restrict it to dynamic arrays, to avoid a duplicate definition. Maybe this could be expanded on to handle string arrays, too. As far as how to define them by type, single, long, etc. That's more complicated.
Edit: Steve was posting while I was writing. I se the same method.In fact, just recently in my replies to the password thread.
Pete