PDA

View Full Version : Array count


crmpicco
06-06-2005, 03:54 PM
sMyArray_5 = Array("Adult Net Net","Weekend Supp.","Pre-Addon","Markup","Agent Markup","Agent Markup (before VAT)","Tax (17.5%)","Gross Fare","Fuel Surcharge","Tax","TOTAL")


How can i count how many values are stored in this array?

Picco

crmpicco
06-06-2005, 03:55 PM
This doesnt work:

arr_count = count(sMyArray_5)

glenngv
06-06-2005, 04:03 PM
upperBound = Ubound (http://www.devguru.com/Technologies/vbscript/quickref/ubound.html)(sMyArray_5)

For references to other methods and properties, just visit www.devguru.com or www.w3schools.com. You've been posting simple questions that can be answered easily by referring to those resources.

Freon22
06-06-2005, 05:10 PM
Keep in mind that Response.Write UBound(sMyArray_5) will return 10 and your array has 11. Its because the count starts at 0, and glenngv is right you should spend a few weeks learning some of the simple stuf. There are hundreds of free teaching sites on vbscript. It will make your coding move along much faster and easyer.

crmpicco
06-06-2005, 05:11 PM
http://www.codingforums.com/showthread.php?t=60550

Freon22
06-06-2005, 07:33 PM
I don't think anyone is going to answer you on that thread. I looked at it and you can use the split function to break it at every : and that will give you an array. But from there you will have to trim it, and it look like the string will be changing sizes. So it is going to take someone writing a function that only take the values between : and /.

Good Luck

miranda
06-06-2005, 08:58 PM
I answered the thread and showed you how to do it.