|
新增键值
- Dim Dic
- Set Dic = CreateObject("Scripting.Dictionary")
- '向Dictionary物件中新增键值对
- Dic.Add "Name", "Sirrah" 'Add方法第一个参数是Key值,第二个是Item值
- Dic.Add "Age", 23
复制代码
刪除键值
- Dim Dic
- Set Dic = CreateObject("Scripting.Dictionary")
- Dic.Add "Name", "Sirrah" '向Dictionary物件中新增键值对
- Dic.Add "Age", 23
- Dic.Item("Age") = 22 '修改键Age的值
- Print Dic.Item("Age") '输出22
复制代码
判断键是否存在
- Dim Dic
- Set Dic = CreateObject("Scripting.Dictionary")
- Dic.Add "Name", "Sirrah" '向Dictionary物件中新增键值对
- Dic.Add "Age", 23
- Print Dic.Exists("Age") '判断键是否存在
复制代码
|
|