reflect.Value.hasKey
Checks if existence of an element in a dictionary.
Syntax
hasKey(
key STRING )
RETURNS BOOLEAN
- key is the key to be checked.
Usage
The hasKey()
method returns TRUE
, if the
reflect.Value
object is a DICTIONARY
that contains an element
identified with the specified key.
The reflect.Value
object used to call this method must have been
created from a DICTIONARY
variable, or is
a reflect.Value
object returned from a method like getField()
, and references a
dictionary.
Example
IMPORT reflect
MAIN
DEFINE dic DICTIONARY OF STRING
DEFINE val reflect.Value
LET dic["key1"] = "aaaaa"
LET dic["key2"] = "bbbbb"
LET val = reflect.Value.valueOf( dic )
CALL val.removeDictionaryElement("key1")
DISPLAY "has key1 : ", val.hasKey("key1")
END MAIN
Shows:
has key1 : 0