วิธีการ Exists ของ ASP

คำอธิบายและวิธีใช้

วิธีการใช้งาน Exists ของภาษา ASP สำหรับ Dictionary วิธีการกำหนดและใช้งาน วิธีการ Exists กลับค่าแบบประกาศที่มีหรือไม่มี key ที่กำหนดใน Dictionary หากมีก็กลับค่า true และหากไม่มีก็กลับค่า false

เนื้อหา

DictionaryObject.Exists(key)
ประกาศ รายละเอียด
key เกี่ยวข้อง สำหรับการค้นหาค่า key ที่ต้องการ

ตัวอย่าง

<%
dim d
set d=Server.CreateObject("Scripting.Dictionary")
d.Add "c","จีน"
d.Add "i","อิตาลี"
d.Add "s","ไทยแลนด์"
if d.Exists("c")=true then
  Response.Write("Key exists!")
else
  Response.Write("Key does not exist!")
end if
set d=nothing
%>

การออกแสดง:

มีการมีอยู่!