Latest web development tutorials

ASP Exists méthode

Dictionnaire Object Reference Complete Dictionary Object Reference

Exists méthode retourne une valeur booléenne, qui est une valeur booléenne indiquant si la clé spécifiée existe dans l'objet Dictionary. S'il y a, il retourne vrai, sinon retourne false.

grammaire

DictionaryObject.Exists(key)

参数 描述
key 必需的。要搜索的 key 值。

Exemples

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

输出:

Key exists!


Dictionnaire Object Reference Complete Dictionary Object Reference