VBS教程:方法-Keys 方法


Keys 方法

返回一数组,其中包含有 Dictionary 对象的所有现存键。

object.Keys

object 应为 Dictionary 对象的名称。

说明

下列代码举例说明如何使用 Keys 方法:

 Function DicDemo Dim a,d,i                        '创建一些变量。Set d = CreateObject("Scripting.Dictionary")d.Add "a","Athens"                '添加键和项目。d.Add "b","Belgrade"d.Add "c","Cairo"a = d.Keys                      '获取键。For i = 0 To d.Count -1          '循环使用数组。s = s & a(i) & "<BR>"          '返回结果。  Next  DicDemo = sEnd Function

« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3