Método Exists do ASP
Definição e Uso
O método Exists retorna um valor booleano que indica se existe a chave especificada no objeto Dictionary. Se existir, retorna true, caso contrário, retorna false.
Sintaxe:
DictionaryObject.Exists(key)
Parâmetro | Descrição |
---|---|
key | Obrigatório. A chave de busca necessária. |
Instância
<% 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("Chave existe!") else Response.Write("Chave não existe!") end if set d=nothing %>
Saída:
Chave existe!