Dictionary Contains Key
Verb: strDictContains
Checks whether a string dictionary contains a specific key.
Syntax
strDictContains --key(String) --dictionary(StringDictionary<Variant>) (Boolean)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--key | Key | Required | Text | Key of which the existence should be checked in the text dictionary. |
--dictionary | Dictionary | Required | String Dictionary<Any> | String dictionary to check for existence of the key specified in the Key parameter. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Contains | Boolean | Returns True if the key inserted in the Key parameter is contained within the text dictionary; otherwise returns False. |
Example
The Dictionary Contains Key command maps the string dictionary, of which the Key-Value Pair items are "City = Austin" and "State = Texas", and checks for the "City" key.
defVar --name stringDictionary --type StringDictionary --innertype String
defVar --name containsKey --type Boolean
// The command "strDictAdd" is used to add "City" and "State" to Key and "Austin" and "Texas" to Value separately in the text dictionary
strDictAdd --key City --value Austin --dictionary ${stringDictionary}
strDictAdd --key State --value Texas --dictionary ${stringDictionary}
logMessage --message "Items added to the text dictionary: \r\n${stringDictionary}" --type "Info"
strDictContains --key City --dictionary ${stringDictionary} containsKey=value
logMessage --message "Dictionary contains the key: ${containsKey}" --type "Info"
// After text dictionary mapping, the following output is returned:
// Items added to the text dictionary:
// [City=Austin, State=Texas]
// Dictionary contains the key: True