字典 scripting.dictionary
1、createobject(「scripting.dictionary」)
(1)add
(2)remove
//定義乙個字典
set objdic = createobject("scripting.dictionary")
objdic.add
"1","aa"
objdic.add
"2","bb"
objdic.add
"3","cc"
objdic.add
"4","dd"
//移除乙個
objdic.remove("3")
//顯示字典個數
msgbox objdic.count
//字典中所有key組成乙個陣列,下標從0開始
key = objdic.keys
//顯示陣列key中第2個元素,值為2
msgbox key(1)
//根據key值獲取字典中的資料
value=objdic.item("1")
msgbox value
----------
//動態陣列
dim arr()
for i = 1to3
redim preserve arr(i-1)
arr(i-1)=i
next
msgbox ubound(arr)
msgbox arr(1)
----------
//excel**
''set excelsheet=excelpath.worksheets("sheet1").usedrange
'rowcount=excelsheet.rows.count
'columncount=excelsheet.columns.count
'excelpath.close
'----------
//excel
function excel(path,sheet)
dim arr()
set excelsheet=excelpath.worksheets(sheet).usedrange
rowcount=excelsheet.rows.count
columncount=excelsheet.columns.count
for i = 1
to rowcount
redim preserve arr(i-1)
arr(i-1)=excelsheet.cells(i,1)
next
set excelsheet=nothing
excelpath.close
excel =arr
end function
----------
//呼叫函式excel
b = excel("d:\uft\data.xlsx","sheet1")
msgbox ubound (b)
msgbox b(0)
for i = 1
to ubound(b)
msgbox b(i)
next
for i = 0
to fromcity.getitemscount -1
if fromcity.getitem(i)=b(i) then
print i& " is right"
else
print i& " is wrong"
endif
next
java 基礎 1 4 陣列
1.介紹 一組相同型別的引用集合,長度固定,永遠不可變,元素長度極限為 integer.maxvalue,下標從0開始,元素最後乙個值下標 array.length 1 2.建立 1.new string 2.new string int 3.4.array.newinstance comparet...
UFT 基礎 描述性程式設計 測試報告 重構下拉框
window flight reservation winedit name set john 描述性程式設計 不用資源庫中的物件也可參執行,第一級用法,若多個屬性不唯一,可以用逗號隔開,寫多個 msgbox window regexpwndtitle flight reservation rege...
14 C 基礎 陣列
陣列宣告形如 a d 其中大小必須大於 0 const unsigned sz 10 常量表示式 int arr sz 含有 10 個整數的陣列 int parr 10 含有 10 個整數的陣列初始化 陣列 int main cout value a 0 endl value 0 return 0 ...