Scripting.Dictionary Dictionary objects in ASP using examples _ Application Tips

Source: Internet
Author: User

The scripting.dictionary of VBScript creates a Dictionary object that is similar to the value of the key index, indexed directly to the specified value.

Examples of scripting.dictionary use in VBScript are as follows:

Copy Code code as follows:

Dim objdict
Set objdict = WSH. CreateObject ("Scripting.Dictionary")
' . ADD (key, value)
Objdict.add "A", "value1"
Objdict.add "B", "value2"
Objdict.add "C", "Value3"
' Directly via Key=b index to value2
WSH. Echo Objdict.item ("B")
Objdict.remove "B" deletes index B and its corresponding value

' The following is the traversal dictionary
Dim Objkeys, Objitems, I
Objkeys = Objdict.keys
Objitems = Objdict.items
For i = 0 to Objdict.count-1
WSH. Echo "key=" & Objkeys (i) &_
"and Value=" & Objitems (i)
Next
' Determines whether the specified key exists
If objdict.exists ("B") Then
WSH. Echo "Found It"
Else
WSH. Echo "Not exists!"
End If
Objdict.removeall ' Clears all keys in the dictionary and their corresponding value
Set objdict = Nothing

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.