Click or drag to resize

Hb_ADel Function

X#
Delete an element from an array and optionally adjust the length of the array.

Namespace:  XSharp.Harbour
Assembly:  XSharp.Harbour (in XSharp.Harbour.dll) Version: 2.19
Syntax
 FUNCTION Hb_ADel(
	aArray,
	nPos,
	lAutoSize
) AS ARRAY CLIPPER
Request Example View Source

Parameters

aArray (Optional)
Type: Usual
Name of array from which an element is to be removed.
nPos (Optional)
Type: Usual
Subscript of the element to be removed. Default value: 1.
lAutoSize (Optional)
Type: Usual
Logic flag specifying if the array will be resized or not. Default value: .F. (no resize).

Return Value

Type: Array
The changed array
Remarks
This function deletes the element value (not the element itself!) stored in position nPos and shifts all the following values, one position up.
If lAutoSize is .T., then the last element is removed and the size of the array is decreased by one, otherwise the length of the array remains unchanged and a NIL value will be stored in the last element, just like in ADel().
Examples
X#
1LOCAL aArray := {1,2,3,4}
2hb_ADel( aArray, 2 )
3? Alen(aArray)  // 4
4? ATail(aArray) // NIL
5hb_ADel( aArray, 2, .T. )
6? Alen(aArray) // 3
7? ATail(aArray) // 4
See Also