hb_HValueAt()

HB_HVALUEAT()

Gets/sets a hash value at a given position

Syntax

      HB_HVALUEAT( <hsTable>, <nPosition>, [<NewValue>] ) -> <Value>

Arguments

<hsTable> a hash table, created by HB_HASH()

<nPosition> the position of an entry within the hash table that will be returned

<NewValue> a new value to be assigned to the hash table at the given position

Returns

The existing value, or the new value if it is given

Compliance

Harbour

hb_HSet()

HB_HSET()

Sets a hash value

Syntax

      HB_HSET( <hsTable>, <Key>, <Value> ) -> <hsTable>

Arguments

<hsTable> a hash table, created by HB_HASH()

<Key> the key of the entry to be set; can be of type: number, date, datetime, string, pointer

<Value> the entry value

Returns

The hash table

Compliance

Harbour

hb_HScan()

HB_HSCAN()

Scans a hash table

Syntax

      HB_HSCAN( <hsTable>, <Value>, [<nStart>], [<nCount>, [<lExact>] )
                -> nPosition

Arguments

<hsTable> a hash table, created by HB_HASH()

<Value> to be located within the hash table

<nStart> starting index, defaults to 1 if omitted

<nCount> counter, defaults to (length) – <nStart> is omitted

<lExact> logical valuye indicating whether the comparision is to be be exact or not

Returns

The position of the located value within the hash table, or zero (0) if not found.

Compliance

Harbour

hb_HPos()

HB_HPOS()

Locates the index of a key within a hash table

Syntax

      HB_HPOS( <hsTable>, <Key> ) -> nPosition

Arguments

<hsTable> a hash table, created by HB_HASH()

<Key> key for which its position is to be determined; can be of type: number, date, datetime, string, pointer

Returns

A integer number being the index position of the key within the hash table.

Compliance

Harbour

hb_HPairAt()

HB_HPAIRAT()

Returns a two-dimensional array of a hash table entry key/value pair

Syntax

      HB_HPAIRAT( <hsTable>, <nPosition> ) -> <aKeyValue>

Arguments

<hsTable> a hash table, created by HB_HASH()

<nPosition> the position of an entry within the hash table that will be returned

Returns

A two-dimensional array of the key/value pair entry of the hash table

Compliance

Harbour

hb_HMerge()

HB_HMERGE()

Merges a source hash table into a destination hash table

Syntax

      HB_HMERGE( <hsDestination>, <hsSource>, <bBlock>|<nPosition> )
              -> <hsDestination>

Arguments

<hsDestination> a destination hash table, created by HB_HASH()

<hsSource> a source hash table, created by HB_HASH()

<bBlock> a code block that will be evaluated for each entry within the source hash table; the code block will be passed the entry key, value and position; if the code block returns a true value, the entry will be added to the destination hash table

<nPosition> the position of an entry within the source hash table that will be appended to the destination hash table

Returns

The destination hash table with the contents of the source hash table merged

Compliance

Harbour

hb_HKeyAt()

HB_HKEYAT()

Gets a hash table key at a given position

Syntax

      HB_HKEYAT( <hsTable>, <nPosition> ) -> <Key>

Arguments

<hsTable> a hash table, created by HB_HASH()

<nPosition> the position of an entry within the hash table that will be returned

Returns

The key at the given position of the hash table; the type will be one: number, date, datetime, string, pointer

Compliance

Harbour