ContainsKey(Key: String): Boolean;
Key. Key of the element, which presence should be checked.
The ContainsKey method checks if there is an element with the specified key.
Sub UserProc;
Var
StrMap: IStringMap;
i: Integer;
s: String;
Begin
StrMap := New StringMap.Create;
For i := 0 To Math.RandBetweenI(50, 100) Do
StrMap.Add("Key_" + Math.RandBetweenI(0, 100).ToString, "Value " + Math.RandBetweenI(0, 100).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: