[thelist] (ASP) Array error weirdness

Ken Schaefer ken at adOpenStatic.com
Sat Aug 16 00:53:02 CDT 2003

Split() returns a variant of subtype array.

However your resulting array doesn't have any elements in it, hence the
error attempting to access the first element. However isArray() still
returns True because the variant is an array subtype.

a) validate the input - ie, require something to come in before running
b) throw exception (as currently), let exception bubble up and handle it
c) check for isEmpty() (I think that's what you want to use - I'd really
recommend option (a) though)


From: "Tab Alleman" <Tab.Alleman at MetroGuide.com>
Subject: [thelist] (ASP) Array error weirdness

Here's a clip of code that is giving me an error I don't expect.

Dim iNight, aNR, i, ThisPrice
i = 0
aNR = Split(NightlyRates, "+") 'in this instance, NightlyRates is an
empty string

IF isArray(aNR) THEN
ThisPrice = aNR(i)
ThisPrice = aNR

The error is:

Subscript out of range: '0'

Now for subscript 0 to be out of range, wouldn't aNR have to not be an
array?  And if it's not an array, then why isn't it getting caught by
the isArray() function?  Am I doing one of these things wrong?
* * Please support the community that supports you.  * *

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !

More information about the thelist mailing list