欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

VBS基礎(chǔ)篇 - vbscript動態(tài)數(shù)組

 更新時間:2018年05月29日 22:36:47   投稿:mdxy-dxy  
VBS中的動態(tài)數(shù)組需要使用System.Collections.ArrayList,需要的朋友可以參考下

腳本文件:b.vbs,包含動態(tài)數(shù)組的添加元素、刪除元素、遍歷、統(tǒng)計元素個數(shù)、清空

實例代碼

'建立動態(tài)數(shù)組
Dim Arrl : Set Arrl = CreateObject("System.Collections.ArrayList")

'添加元素
Arrl.Add "Element3"
Arrl.Add "Element2"
Arrl.Add "Element1"

'查看動態(tài)數(shù)組中的元素數(shù)
WScript.Echo "動態(tài)數(shù)組中現(xiàn)有元素數(shù)量: " & Arrl.Count
WScript.Echo "動態(tài)數(shù)組容量: " & Arrl.Capacity

WScript.Echo

'遍歷動態(tài)數(shù)組
Sub TraverseArrl
 Dim Counter
 For Counter = 0 To Arrl.Count - 1
  WScript.Echo Arrl(Counter)
 Next
End Sub
TraverseArrl

WScript.Echo

'動態(tài)數(shù)組排序
Arrl.Sort
TraverseArrl

WScript.Echo

'刪除指定元素
Arrl.Remove("Element1")
TraverseArrl

WScript.Echo

'清空全部元素
Arrl.Clear
WScript.Echo "動態(tài)數(shù)組中現(xiàn)有元素數(shù)量: " & Arrl.Count
WScript.Echo "動態(tài)數(shù)組容量: " & Arrl.Capacity

調(diào)用方法:通過雙擊b.bat調(diào)用,b.bat代碼如下:

cscript b.vbs
pause

運行結(jié)果截圖:

相關(guān)文章

最新評論