tstringmap.md 3.2 KB


id: tstringmap title: TStringMap

sidebar_label: TStringMap

A key/value (String/Object) map.

Operators

Method Operator[]:Object(key:String)

Finds a value given a key using index syntax.

If the map does not contain key, a Null object is returned.

Returns

The value associated with key.

Example

SuperStrict

Framework brl.standardio
Import brl.map

Local map:TStringMap = New TStringMap

map.Insert("one", "Hello")
map.Insert("two", "World")

For Local s:String = EachIn map.Keys()
	Print s + " = " + String(map[s]) ' retrieve value using index operator
Next


Method Operator[]=(key:String, value:Object)

Inserts a key/value pair into the map using index syntax.

If the map already contains key, its value is overwritten with value.

Example

SuperStrict

Framework brl.standardio
Import brl.map

Local map:TStringMap = New TStringMap

map["one"] = "Hello" ' insert value using index operator
map["two"] = "World"

For Local s:String = EachIn map.Keys()
	Print s + " = " + String(map.ValueForKey(s))
Next


Methods

Method Clear()

Clears the map.

Removes all keys and values.


Method IsEmpty()

Checks if the map is empty.

True if map is empty, otherwise False.


Method Insert( key:String,value:Object )

Inserts a key/value pair into the map.

If the map already contains key, its value is overwritten with value.


Method Contains:Int( key:String )

Checks if the map contains key.

Returns

True if the map contains key.


Method ValueForKey:Object( key:String )

Finds a value given a key.

If the map does not contain key, a Null object is returned.

Returns

The value associated with key.


Method Remove( key:String )

Remove a key/value pair from the map.

Returns

True if key was removed, or False otherwise.


Method Keys:TStringMapEnumerator()

Gets the map keys.

The object returned by Keys can be used with EachIn to iterate through the keys in the map.

Returns

An enumeration object


Method Values:TStringMapEnumerator()

Get the map values.

The object returned by Values can be used with EachIn to iterate through the values in the map.

Returns

An enumeration object.


Method Copy:TStringMap()

Returns a copy the contents of this map.


Method ObjectEnumerator:TStringNodeEnumerator()

Returns a node enumeration object.

The object returned by ObjectEnumerator can be used with EachIn to iterate through the nodes in the map.