Page 1 of 1

Searching for empty arrays

Posted: Mon Jan 23, 2017 7:53 pm
by kinosh
I have an array, some contain strings and some are empty (no integers). Is there a way to find the empty arrays?

Re: Searching for empty arrays

Posted: Wed Jan 25, 2017 8:49 pm
by burger2227
LEN can tell you how long a string is in each part of the array. 0 is an empty index.

Code: Select all

DIM array$(100)

FOR i = 0 TO 99  'set indices 
    array$(i) = "AA"
NEXT

PRINT array$(50)  'read an index
PRINT LEN(array$(50)) 'display length of string

PRINT LEN(array$)
You will have to read each index using a FOR loop.
LEN can NOT be used on numerical arrays as it will only show the number's
byte size which never changes even for 0.