xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HDelAt()

Removes a key/value pair from the hash by its ordinal position.

Syntax

HDelAt( <hHash>, <nPos> ) --> NIL

Arguments

<hHash>
A variable referencing the hash to remove a key/value pair from.
<nPos>
A numeric value specifying the ordinal position of the key/value pair to remove. It must be in the range between 1 and Len(<hHash>).

Return

The function returns always NIL.

Description

The function removes a key/value pair from the hash <hHash> by its ordinal position. If <nPos> is outside the valid range, a runtime error is raised. Use function HGetPos() to determine the ordinal position of a key.

Info

See also:Hash(), HDel(), HGet(), HGetPos(), HSet()
Category: Hash functions , xHarbour extensions
Source:vm\hash.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The function deletes a key/value pair from a hash
// by ordinal position.

   PROCEDURE Main
      LOCAL hHash := Hash( "A",10, "B",20 , "C",30 , "D",40 )

      HDelAt( hHash, 3 )

      ? ValToPrg( hHash )
      // result: { "A" => 10, "B" => 20, "D" => 40 }
   RETURN

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