[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
Pete's QBASIC Site • Searching for empty arrays
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.