1) Personal preference. I hardly ever use zero in array routine. The reason, if I'm referencing the third value, I want to use array(3), not array (2).
2) These sub-routines only support one numerical variable type. Mine passes the array by reference, but that still requires a type declaration.
3) This method seems to be better suited for non-dimensioned string arrays, with the proper code conversion, of course.
Universal non-dim string example...
For those who like to start their arrays at zero...
Pete
2) These sub-routines only support one numerical variable type. Mine passes the array by reference, but that still requires a type declaration.
3) This method seems to be better suited for non-dimensioned string arrays, with the proper code conversion, of course.
Universal non-dim string example...
Code: (Select All)
REDIM lNUMS(0) AS STRING: myray lNUMS(), "cow, pig, elephant, rhino, elephino"
FOR i = 1 TO 5
PRINT lNUMS(i)
NEXT
SUB myray (myarray() AS STRING, 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) = MID$(myarray_elements, seed + 1, j - seed - 1)
seed = j + 1
LOOP
END SUB
For those who like to start their arrays at zero...
Code: (Select All)
REDIM lNUMS(0) AS STRING: myray lNUMS(), "cow, pig, elephant, rhino, elephino"
FOR i = 0 TO 4
PRINT lNUMS(i)
NEXT
SUB myray (myarray() AS STRING, myarray_elements AS STRING)
DO
j = INSTR(seed, myarray_elements + ",", ",")
IF j = 0 THEN EXIT DO
REDIM _PRESERVE myarray(i)
myarray(i) = MID$(myarray_elements, seed + 1, j - seed - 1)
seed = j + 1: i = i + 1
LOOP
END SUB
Pete
If eggs are brain food, Biden takes his scrambled.