ASP ExistsMethod


Dictionary 对象参考手册Complete Dictionary Object Reference Manual

The Exists method returns a Boolean value that indicates whether a specified key exists in the Dictionary object. If it exists, it returns true; otherwise, it returns false.

Syntax

DictionaryObject.Exists(key)

Parameters Description
key Required. The key value to search for.

Example

<%
dim d
set d=Server.CreateObject("Scripting.Dictionary")
d.Add "n","Norway"
d.Add "i","Italy"
d.Add "s","Sweden"

if d.Exists("n")=true then
  Response.Write("Key exists!")
else
  Response.Write("Key does not exist!")
end if

set d=nothing
%>

Output:

Key exists!


Dictionary 对象参考手册Complete Dictionary Object Reference Manual Other Extensions