This version is out of date, covering development from v9.5.0 to v9.7.3. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

Tinderbox v9 Icon

dictionary(dictionaryStr)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

 Function  [other Function type actions]

 Document  [operators of similar scope]

 Dictionary, Set & List operations  [other Dictionary, Set & List operations operators]

 Baseline

 As at baseline


dictionary(dictionaryStr)

This operator constructs a new dictionary from a dictionaryStr. The dictionaryStr must contain pairs of keys and values separated by a colon; each key/value pair is separated by a semicolon. For example:

$MyDictionary=dictionary("cat:animal; dog:animal; rock: mineral"); 

The key "cat" has the value "animal", while the key "rock" has the value "mineral".

Normally the output will be passed to a Dictionary attribute, but if passed to an action code variable the latter should function as if a dictionary.

The operator's input string will be in the form of semi-colon delimited set of key:value pairs, i.e.

$MyDictionary = dictionary("cat:animal; dog:animal; rock:mineral"); 

Or

$MyString = "cat:animal; dog:animal; rock:mineral"; 

$MyDictionary = dictionary($MyString); 

dictionary({dictionaryStr})

Using the newer {}-defined declaratory method for dictionary data:

$MyDictionary = dictionary({cat:animal; dog:animal; rock:mineral}); 

Or

$MyString = "cat:animal; dog:animal; rock:mineral"; 

$MyDictionary = dictionary({$MyString}); 

Here the braces (curly brackets) replace the need for quotes enclosing strings.

Direct creation from a string (deprecated)

It is possible that a dictionary can be made by passing an appropriately structured string to a Dictionary type attribute, thus:

$MyDictionary = "cat:animal; dog:animal; rock:mineral"; 

This latter usage is deprecated and the more explicit dictionary() operator should be used in its place.