VBS中ArrayList的用法

Set myList=CreateObject("System.Collections.ArrayList")

With myList
.Add("001")
.Add("002")
.Add("007")
.Add("004")
.Add("003")
.Add("009")
End With

msgbox myList.Item(2)

For i=0 to myList.count-1
msgbox myList.Item(i)
Next

myList.RemoveAt(2)

msgbox myList.Item(2)

myList.Insert 2,"007"

msgbox myList.Item(2)

myList.Sort

For i=0 to myList.count-1
msgbox myList.Item(i)
Next

运行结果依次为:

007

001 002 007 004 003 009

004

007

001 002 003 004 007 009

原文地址:https://www.cnblogs.com/testerZH/p/2231051.html