class referencing an array of ASP operations written in C # ArrayList

Source: Internet
Author: User
Tags array length empty

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
'******************************/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.