reflect.Value.removeDictionaryElement

Deletes an element of a dictionary.

Syntax

removeDictionaryElement(
     key STRING )
  1. key is the key of the element to be removed.

Usage

The removeDictionaryElement() method removes an element associated to the specified key, from the dictionary represented by this reflect.Value object.

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.

If the key does not exist, the method returns silently without error.

Example

IMPORT reflect
MAIN
    DEFINE dic DICTIONARY OF STRING
    DEFINE val reflect.Value
    DEFINE elem reflect.Value
    LET dic["key1"] = "aaaaa"
    LET dic["key2"] = "bbbbb"
    LET val = reflect.Value.valueOf( dic )
    DISPLAY "has key1 : ", val.hasKey("key1")
    DISPLAY "has key2 : ", val.hasKey("key2")
    DISPLAY "has zzzz : ", val.hasKey("zzzz")
END MAIN
Shows:
has key1 :      1
has key2 :      1
has zzzz :      0