Exists Method (Script Runtime)
Updated: September 2009
Returns true if a specified key exists in the Dictionary object, false if it does not.
object
.Exists(
key
)
The following example illustrates the use of the Exists method.
function keyExists(k) { var fso, s = ""; d = new ActiveXObject("Scripting.Dictionary"); d.Add("a", "Athens"); d.Add("b", "Belgrade"); d.Add("c", "Cairo"); if (d.Exists(k)) s += "Specified key exists."; else s += "Specified key does not exist."; return(s); }
Function KeyExists(k)
Dim d, msg
Set d = CreateObject("Scripting.Dictionary")
d.Add "a", "Athens"
d.Add "b", "Belgrade"
d.Add "c", "Cairo"
If d.Exists(k) Then
msg = "Specified key exists."
Else
msg = "Specified key does not exist."
End If
KeyExists = msg
End Function
Applies To:
Community Additions
Show: