THE WORLD'S LARGEST WEB DEVELOPER SITE

ASP Exists Method


❮ Complete Dictionary Object Reference

The Exists method returns a Boolean value that indicates whether a specified key exists in the Dictionary object. It returns true if the key exists, and false if not.

Syntax

DictionaryObject.Exists(key)

Parameter 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!

❮ Complete Dictionary Object Reference