xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HGetValues()

Collects all values from a hash in an array.

Syntax

HGetValues( <hHash> ) --> aValues

Arguments

<hHash>
A variable referencing the hash to retrieve all values from.

Return

The function returns a one-dimensional array holding in its elements the values of <hHash>.

Description

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.

Info

See also:Hash(), HGetKeys(), HGetValueAt()
Category: Hash functions , xHarbour extensions
Source:vm\hash.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe