Remove from Dictionary

Verb: strDictRemove

Removes a specific key from a string dictionary.

Syntax

strDictRemove --key(String) --dictionary(StringDictionary<Variant>) (Boolean)=value

Inputs

Script Designer Required AcceptedTypes Description
--key Key Required Text Key value that should be removed from the string dictionary.
--dictionary Dictionary Required String Dictionary<Any> String dictionary that should have a key removed.

Outputs

Script Designer AcceptedTypes Description
value Value Boolean Returns True if the removal of the key specified in the parameter Remove from Dictionary is successful; otherwise returns False.

Example

Removes the "State" key from the string dictionary of which the Key-Value Pair values ​​are "City = Chicago" and "State = Illinois"

defVar --name stringDictionary --type StringDictionary --innertype String
defVar --name keyRemoved --type Boolean
// The command "strDictAdd" is used to add "City" and "State" to Key and "Chicago" and "Illinois" to Value separately in the string dictionary.
strDictAdd --key City --value Chicago --dictionary ${stringDictionary}
strDictAdd --key State --value Illinois --dictionary ${stringDictionary}
logMessage --message "Items added to the string dictionary: \r\n${stringDictionary}" --type "Info"
// The command "strDictRemove" is used to remove the "State" key from the string dictionary.
strDictRemove --key State --dictionary ${stringDictionary} keyRemoved=value
logMessage --message "Key removed from string dictionary: ${keyRemoved}" --type "Info"
// Returns the following output:
// Items added to the string dictionary:
// [City=Chicago, State=Illinois]
// Key removed from string dictionary: True

Remarks

Removing the key specified in the Key parameter also removes all values associated with it.

See Also

  • Add to String Dictionary
  • Dictionary Contains Key
  • Get Dictionary Value
  • Update String Dictionary