Latest web development tutorials

ASP Exists 方法

Dictionary 對象參考手冊 完整的Dictionary對象參考手冊

Exists 方法返回一個布爾值,該布爾值指示在Dictionary 對像中是否存在指定的key。 如果存在,返回true,否則返回false。

語法

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!


Dictionary 對象參考手冊 完整的Dictionary對象參考手冊