xHarbour Reference Documentation > Function Reference |
Removes a key/value pair from an associative array.
HaaDelAt( <hArray>, <nPos> ) --> NIL
The function returns always NIL.
The function removes a key/value pair from the associative array <hArray> by its ordinal position. If <nPos> is outside the valid range, a runtime error is raised. Use function HaaGetPos() to determine the ordinal position of a key.
See also: | Array(), HaaGetKeyAt(), HaaGetValueAt(), HaaSetValueAt(), Hash(), HSetAACompatibility() |
Category: | Associative arrays , Hash functions , xHarbour extensions |
Source: | vm\hash.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example creates an associative array and deletes // the third key/value pair. PROCEDURE Main LOCAL hArray := Hash() HSetAACompatibility( hArray, .T. ) hArray[ "One" ] := 10 hArray[ "Two" ] := 20 hArray[ "Three"] := 30 hArray[ "Four" ] := 40 hArray[ "Five" ] := 50 ? hArray[ 3 ] // result: 30 ? hArray["Four"] // result: 40 HaaDelAt( hArray, 3 ) ? hArray[ 3 ] // result: 40 ? hArray["Four"] // result: 40 RETURN
http://www.xHarbour.com