Hb_AIns Function | |
Inserts a value at an array subscript position and optionally increases the length of array.
Namespace:
XSharp.Harbour
Assembly:
XSharp.Harbour (in XSharp.Harbour.dll) Version: 2.19
Syntax FUNCTION Hb_AIns(
aArray,
nPos,
xValue,
lAutoSize
) AS ARRAY CLIPPER
[ClipperCallingConventionAttribute(new string[] { ... })]
public static Array Hb_AIns(
Usual aArray = default,
Usual nPos = default,
Usual xValue = default,
Usual lAutoSize = default
)
Request Example
View SourceParameters
- 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. - xValue (Optional)
- Type: Usual
Value to be inserted - lAutoSize (Optional)
- Type: Usual
Boolean flag specifying if the array will be resized or not.
Default value: .F. (no resize).
Return Value
Type:
ArrayThe changed array
Remarks
This function inserts xValue in the nPos position of the array, moving all the items
one position down in the array list.
If lAutoSize is .T., a new element will be added at the end of array, making room
for the previous last element, which means the length of array will be increased by 1.
If lAutoSize is .F. (or is not passed) the function behaves like AIns(), that is, the
size of aArray won't change and the last item of aArray will be lost.
Examples 1LOCAL aArray := {1,3,4}
2hb_AIns( aArray, 2 ,2)
3? Alen(aArray)
4? aTail(aArray)
5aArray := {1,3,4}
6hb_AIns( aArray, 2 , 2, .T.)
7? Alen(aArray)
8? ATail(aArray)
See Also