| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Collects all values from a hash in an array.
HGetValues( <hHash> ) --> aValues
The function returns a one-dimensional array holding in its elements the values of <hHash>.
This function retrieves all values from a hash and collects them in an array. The ordinal position of a value in the returned array is identical with the position in the hash.
| See also: | Hash(), HGetKeys(), HGetValueAt() |
| 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 aValues := HGetValues( hHash )
? aValues[1] // result: 40
? aValues[3] // result: 10
? HGetValueAt( hHash, 1 ) // result: 40
? HGetValueAt( hHash, 3 ) // result: 10
RETURN
http://www.xHarbour.com