Click to See Complete Forum and Search --> : counting items in an array (with builtin function?)


fark
10-15-2003, 09:45 AM
Is there an easy way to count the number of items in an array (without looping through it and running a counting variable). Like a built in funtion? I looked at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctarray.asp
and didn't see anything.
Temp= Split(Input, "&", -1, 1)
I want to count how many items are stored in temp.
Split returns an array like I had written
Temp=Array(10,20,30)
I tried Temp.count and it didn't seem to work
Thanks for your help.

fark
10-15-2003, 01:27 PM
I happened to come across a sample (at www.asp101.com)that had a way to do this. I knew it had to be possible but couldn't find a function that would do it. Thanks


iArraySize = (UBound(Array) - LBound(Array))

pelegk1
10-20-2003, 02:22 AM
in js its : temp.length
in vb its : len(temp)

rdoekes
10-20-2003, 03:30 AM
Pelegk1,

Len(temp) in VB will generate an error, since when using Len, temp needs to be of type string. Here we are talking about arrays.
-Rogier Doekes