ASP Exists Method

Definition and Usage

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

Syntax:

DictionaryObject.Exists(key)
Parameter Description
key Required. The key value to be searched.

Instance

<%
dim d
set d=Server.CreateObject("Scripting.Dictionary")
d.Add "c","China"
d.Add "i","Italy"
d.Add "s","Sweden"
if d.Exists("c")=true then
  Response.Write("Key exists!")
else
  Response.Write("Key does not exist!")
end if
set d=nothing
%>

Output:

Key exists!