Day25 - Dictionary字典

今日学习目标

  • 理解Dictionary对象
  • 掌握字典的增删改查
  • 学会使用字典处理数据

知识点

### Dictionary对象
``vba
Dim dict As Object
Set dict = CreateObject("Scripting.Dictionary")
dict.Add "key", value
dict("key") = newValue
dict.Exists("key")
dict.Remove("key")
``

今日代码

Dim dict As Object
Set dict = CreateObject("Scripting.Dictionary")

dict.Add "key", value
dict("key") = newValue
dict.Exists("key")
dict.Remove("key")

练习题

  1. 使用字典进行数据查询
  2. 统计词频
  3. 实现数据映射