Onn*_*esh 8 collections vbscript
应该是create object 以下代码的参数
dim a
set a=CreateObject("Collection") //getting a runtime error saying ActiveX
//component can't create object: 'Collection
a.add(CreateObject("Collection"))
a.Items(0).Add(1)
MsgBox(a.Items(0).count)
MsgBox(a.Items(0).Item(0))
Run Code Online (Sandbox Code Playgroud)
Tes*_*101 14
一本字典怎么样?
Set a = CreateObject("Scripting.Dictionary")
a.Add 0, "5"
a.Add 4, "10"
MsgBox a.Count
MsgBox a.Item(0)
MsgBox a.Item(4)
Run Code Online (Sandbox Code Playgroud)
小智 5
这是代码,它的功能强大:
Option Explicit
dim list
Set list = CreateObject("System.Collections.ArrayList")
list.Add "Banana"
list.Add "Apple"
list.Add "Pear"
list.Sort
list.Reverse
wscript.echo list.Count ' --> 3
wscript.echo list.Item(0) ' --> Pear
wscript.echo list.IndexOf("Apple", 0) ' --> 2
wscript.echo join(list.ToArray(), ", ") ' --> Pear, Banana, Apple
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
33335 次 |
| 最近记录: |