xHarbour Reference Documentation > Function Reference |
Collects all keys from a hash in an array.
HGetKeys( <hHash> ) --> aKeys
The function returns a one-dimensional array holding in its elements copies of the keys of <hHash>.
This function retrieves all keys from a hash and collects them in an array. The ordinal position of a key in the returned array is identical with the position in the hash.
See also: | Hash(), HGetKeyAt(), HGetValues() |
Category: | Hash functions , xHarbour extensions |
Source: | vm\hash.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The function retrieves all keys of a hash. // Note that the creation order of key/value pairs does not // affect their insertion order (which is A B C D). PROCEDURE Main LOCAL hHash := Hash( "C", 10, "D", 30, "A", 40, "B", 20 ) LOCAL aKeys := HGetKeys( hHash ) ? aKeys[1] // result: A ? aKeys[3] // result: C ? HGetKeyAt( hHash, 1 ) // result: A ? HGetKeyAt( hHash, 3 ) // result: C RETURN
http://www.xHarbour.com