Some issues to be noted in ASP array operations:
1,lbound () and UBound () are the smallest and largest index values in the array, not the length of the array,
The length of the array is: UBound () +1
2, sometimes you want to dynamically change the size of an array, so declare an empty array first:
Dim arr()
An empty array declared in this way can cause an error if it is evaluated with LBound () and UBound (), but you can use for each:
Dim arr()
For Each v In arr
Response.Write v
Next
So there's no mistake.
Another way to declare an empty array is to:
Dim arr
arr=array()
In this way, LBound (arr) and UBound (arr) are used to return 0 and 1, respectively.
ArrayList class function Description:
' ***************arraylist Property ***************
' Arraylist.length: Array length
' ***************arraylist method ***************
'---array add:
' Arraylist.add (v): Add an element to the tail of the ArrayList
' Arraylist.addarray (arr): Append an array to the ArrayList tail
' Arraylist.insert (INDEX,V): Inserts a value at the index at ArrayList, and the original index and subsequent values are moved backwards
' Arraylist.insertarray (Index,arr): Inserts an array at the index of ArrayList, and the original index and subsequent values move backwards
'---array update:
' Arraylist.update (index,v): Update value at index
'---array deletion:
' Arraylist.remove (v): Deletes the first occurrence from the ArrayList, note that the first one, will get a new array
' Arraylist.removeat (Index): Removes the element at the specified index of the ArrayList and will get a new array
' Arraylist.splice (m,n): Removes an element from index m to index n from an array and returns the removed array
' Arraylist.clear () empties the array, the array becomes empty, the length length=0
'---array lookup:
' Arraylist.indexof (v): lookup, returns the index of the first occurrence of ArrayList. Not found return-1.
' Arraylist.lastindexof (v): Returns the index of the last occurrence of ArrayList. Not found return-1.
'---Returns the values in the array:
' Arraylist.getvalue (index) Gets the value of a ArrayList index
' Arraylist.slice (m,n) returns an array of ArrayList from M to n
' Arraylist.getarray () returns an array of the entire array
'---array other actions:
' Arraylist.reverse () reverses the order of elements in the entire ArrayList
' Arraylist.implode (separator) returns a string value separated by the specified delimiter
'******************************/