Searching for empty arrays
Searching for empty arrays
I have an array, some contain strings and some are empty (no integers). Is there a way to find the empty arrays?
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
Re: Searching for empty arrays
LEN can tell you how long a string is in each part of the array. 0 is an empty index.
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.
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$)
LEN can NOT be used on numerical arrays as it will only show the number's
byte size which never changes even for 0.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0