Dictionary.HasKey

From Xojo Documentation

Method

Dictionary.HasKey(Key As Variant) As Boolean

Supported on Desktop, Web, Console.

Returns True if Key is in the Dictionary and False if it is not.

Notes

Returns a Boolean. The HasKey function is encoding-sensitive. The Dictionary works off hash functions and the hash of a UTF-16 string is vastly different from the hash of a UTF-8 string.

Sample Code

This example checks to see if the key corresponding to the passed color is in the Dictionary.

If d.HasKey(RGB(255, 0, 0)) Then
MessageBox(d.Value(RGB(255, 0, 0)))
Else
MessageBox("The Red Key is not in the dictionary.")
End If