Determines whether or not a key exists in an SRP Hash Table.

Syntax

Result = SRP_HashTable_Contains(Handle, Key)

Returns

1 if the key exists within the SRP Hash Table or 0 if it does not.

Parameters

ParameterDescription
HandleHandle to an existing SRP Hash Table (REQUIRED)
KeyThe key to evaluate in the SRP Hash Table (REQUIRED)

Remarks

The SRP_HashTable_Contains method determines if the key exists in the hash table due to a previous call to SRP_HashTable_Set. This is particularly useful if your keys might map to empty values since an empty value is also returned when a key doesn't exist.

IMPORTANT: You should always release the handle to an SRP Hash Table when you no longer need it by calling SRP_HashTable_Release.

Examples

// Create a case-insensitive hash table
Handle = SRP_HashTable_Create()

// Add some entries
SRP_HashTable_Set(Handle, "Amazon", "http://www.amazon.com")
SRP_HashTable_Set(Handle, "Google", "http://www.google.com")
SRP_HashTable_Set(Handle, "Revelation", "http://www.revelation.com")
SRP_HashTable_Set(Handle, "SRP", "http://www.srpcs.com")
SRP_HashTable_Set(Handle, "Yahoo", "http://www.yahoo.com")

// This will return 1
Exists = SRP_HashTable_Contains(Handle, "SRP")

// This will return 0
Exists = SRP_HashTable_Contains(Handle, "Microsoft")
  • No labels