Metoda ASP existuje


❮ Vyplňte referenční objekt slovníku

Metoda Exists vrací booleovskou hodnotu, která označuje, zda zadaný klíč existuje v objektu Dictionary. Vrací hodnotu true, pokud klíč existuje, a false, pokud ne.

Syntax

DictionaryObject.Exists(key)

Parameter Description
key Required. The key value to search for

Příklad

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

❮ Vyplňte referenční objekt slovníku