Get the value paired with a given key in an SRP Hash Table.
Syntax
Value = SRP_HashTable_Get(Handle, Key)
Returns
The value at the given key, "" otherwise.
Parameters
Parameter | Description |
---|---|
Handle | Handle to an existing SRP Hash Table (REQUIRED) |
Key | The key whose value to get (REQUIRED) |
Remarks
The SRP_HashTable_Get method returns the value paired to the given key. If the hash table doesn't recognize the key, "" is returned. However, it is possible to have an empty value paired with a key. You can determine that "" is the result of a missing key using SRP_HashTable_Contains.
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") SRP_HashTable_Set(Handle, "Empty", "") // This will return "http://www.srpcs.com" Value = SRP_HashTable_Get(Handle, "SRP") // This will return "" because the key does not exist (Exists will be 0) Value = SRP_HashTable_Get(Handle, "Foo") Exists = SRP_HashTable_Contains(Handle, "Foo") // This will return "" because that is the value we stored (Exists will be 1) Value = SRP_HashTable_Get(Handle, "Empty") Exists = SRP_HashTable_Contains(Handle, "Empty")