ASP Exists 方法

定义和用法

Exists 方法返回在 Dictionary 对象中是否存在指定的 key 的布尔值。如果存在,返回 true,否则返回 false

语法:
  1. DictionaryObject.Exists(key)
参数描述
key必需的。需搜索的 key 值。

实例

  1. <%
  2. dim d
  3. set d=Server.CreateObject("Scripting.Dictionary")
  4. d.Add "c","China"
  5. d.Add "i","Italy"
  6. d.Add "s","Sweden"
  7. if d.Exists("c")=true then
  8. Response.Write("键存在!")
  9. else
  10. Response.Write("键不存在!")
  11. end if
  12. set d=nothing
  13. %>

输出:

  1. 键存在!

分类导航