ASPは、Existsメソッドを
メソッドは指定されたキーがDictionaryオブジェクトに存在するかどうかを示すブール値であるブール値を返しますが存在します。 ある場合は、それ以外の場合はfalseを返し、trueを返します。
文法
DictionaryObject.Exists(key)
参数 | 描述 |
---|---|
key | 必需的。要搜索的 key 值。 |
例
<%
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!
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!
辞書オブジェクト参照を完了します