Latest web development tutorials

ASP มีอยู่วิธี

อ้างอิงวัตถุพจนานุกรม อ้างอิงวัตถุสมบูรณ์พจนานุกรม

มีอยู่วิธีการส่งกลับค่าบูลีนซึ่งเป็นค่าบูลีนระบุว่ากุญแจสำคัญที่ระบุอยู่ในวัตถุพจนานุกรม หากมีก็จะส่งกลับจริงมิฉะนั้นกลับเท็จ

ไวยากรณ์

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!


อ้างอิงวัตถุพจนานุกรม อ้างอิงวัตถุสมบูรณ์พจนานุกรม