IStringMap.ContainsKey

Syntax

ContainsKey(Key: String): Boolean;

Parameters

Key. Key of the element, which presence should be checked.

Description

The ContainsKey method checks if there is an element with the specified key.

Example

Sub UserProc;
Var
    StrMap: IStringMap;
    i: Integer;
    s: String;
Begin
    StrMap := New StringMap.Create;
    For i := 0 To Math.RandBetweenI(50100Do
        StrMap.Add("Key_" + Math.RandBetweenI(0100).ToString, "Value " + Math.RandBetweenI(0100).ToString);
    End For;
    If StrMap.ContainsKey("Key_50"Then
        s := "Yes";
    Else
        s := "No";
    End If;
End Sub UserProc;

After executing the example a string map of random size is generated. Elements with repeated keys are overwritten. The "s" variable contains Yes if element with the Key_50 key exists in the map.

See also:

IStringMap