Méthode Exists ASP
Définition et utilisation
La méthode Exists renvoie une valeur booléenne indiquant si la clé spécifiée existe dans l'objet Dictionary. Si elle existe, elle renvoie true, sinon false.
Syntaxe :
DictionaryObject.Exists(key)
Paramètre | Description |
---|---|
Clé | Obligatoire. La valeur de clé à rechercher. |
Instance
<% dim d set d=Server.CreateObject("Scripting.Dictionary") d.Add "c","Chine" d.Add "i","Italie" d.Add "s","Suisse" if d.Exists("c")=true then Response.Write("Key exists!") else Response.Write("Key does not exist!") end if set d=nothing %>
Sortie :
Clé existe !