Arrays in VBScript are zero based and cannot be changed to base 1 (option
base 1) as they can in VB. So, knowing that and knowing the UBound
function, the number of items in an array is the ubound of the dimension +
1.
name_of_customer = Split(customer_name," ", -1, 1)
NumberOfItems = UBound(name_of_customer, 1) + 1
The ",1" is an optional argument for single dimensional arrays. The array
dimensions start at 1, not 0.
Ray at work
"JT" <je******@sppinc.net> wrote in message
news:O%****************@TK2MSFTNGP09.phx.gbl...
how do i determine how many items are in an array? the following code
creates an array of values each time a space is found in a name field.
the problem is that sometimes names have middle initials and sometimes they do
not. so i want to determine how many items exist in this array created by
the split BEFORE assigning values:
name_of_customer = Split(customer_name," ", -1, 1)
first_name = name_of_customer(0)
middle_initial = name_of_customer(1)
thanks much
jt