VBS using SCRIPTING.DICTIONARY Dictionary objects

Source: Internet
Author: User

VBS using SCRIPTING.DICTIONARY Dictionary objects

Tags: scripting.dictionary, VBS, VBScript, dictionary

Title: VBS using SCRIPTING.DICTIONARY Dictionary objects
Author: Demon
Links: http://demon.tw/copy-paste/vbs-scripting-dictionary-object.html
Copyright: All articles of this blog are subject to the terms "Attribution-NonCommercial use-share 2.5 mainland China" in the same way.

Scripting.Dictionary is a useful component that creates a Dictionary object similar to the value of a key index, and provides a mechanism for fast index access within it, allowing us to index directly to the specified value via key, which is much more efficient than traversing a two-dimensional array.

This is how it is accessed in VBScript.

Dim Objdictset objdict = WSH. CreateObject ("Scripting.Dictionary") '. ADD (key, value)    Objdict.add "A", "value1" Objdict.add "B", "value2" Objdict.add "C", "value3" directly through key= b Index to Value2wsh.echo (Objdict.item ("B")) Objdict.remove ("B") ' Delete index B and its corresponding value ' below is the traversal dictionary Dim objkeys, objitems, Iobjkeys = Objdict.keysobjitems = Objdict.itemsfor i = 0 to objdict.count-1    WSH. Echo ("key=" & Objkeys (i) & _    "and value=" & Objitems (i)); Next ' determines if the specified key exists if objdict.exists ("B") then    WSH. Echo ("Found it") Else    WSH. Echo ("Not exists!") End Ifobjdict.removeall  ' Clears all keys in the dictionary and their corresponding valueset objdict = Nothing

Original link: http://wangye.org/blog/archives/60/

Related articles:

    1. VBS scripting.dictionary Dictionary object key name key to bubble sort
    2. QWERTY password: Encryption and decryption
    3. Rethinking the efficiency of VBS--processing binary data
    4. Implementation of Bencode algorithm with VBS
    5. Efficiency issues with string joins in VBS

VBS using SCRIPTING.DICTIONARY Dictionary objects

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.