ASP Exists メソッド

定義と用法

Exists メソッドは、Dictionary オブジェクトに指定されたキーが存在するかどうかの布尔値を返します。存在する場合、true を返し、存在しない場合、false を返します。

语法:

DictionaryObject.Exists(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("キーが存在します!")
else
  Response.Write("キーが存在しません!")
end if
set d=nothing
%>

出力:

キーが存在します!