Return to Language Reference home pageHarbour API Explorer
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Only APIs with Curated Documentation are available from this screen.
Most API (functions) description comes from https://github.com/Petewg/harbour-core/wiki. Same content license applies.
To search all Harbour Core, Contribs and Packages APIs, including undocumented ones, go to Source Code Explorer.
Found 22 APIs
AAdd(<aArray>,<xValue>) ➔ <xValue>

This function attempts to add an element to the end of <aArray> and optionally assigns the value <xValue> to this new element.
If the addition succeeds, the length of the array increases by one and the function returns either the value <xValue>, _if one specified_, or NIL.
Note that the presence of the 2nd argument (or at least the comma next to the 1st one, in which case NIL is implied as xValue) is mandatory, even if a specific xValue is not meant to be simultaneously added, otherwise RTE occurs; in such a case, the effect is identical to _ASize(aArray, Len(aArray)+1)_.


AClone(<aSource>) ➔ <aDuplicate>

Duplicates an array (Deep Copy). Works with multidimensional arrays.


ACopy(<aSource>,<aTarget>,[<nStart>],[<nCount>],[<nTagetPos>]) ➔ <aTarget>

Copy elements from a source array into a target array. Operates only on one-dimensional arrays.


ADays() ➔ <aDays>

Returns an array with all the days names in the selected current language.


ADel(<aArray>,<nPosition>) ➔ <aArray>

Deletes the element at position <nPosition> from the array <aArray>. All subsequent elements are shifted up by one position so that the last element contains the value NIL. See hb_Adel() for extra functionality.


AEval(<aArray>,<bBlock>,[<nStart>],[<nCount>]) ➔ <aArray>

Evaluates the <bBlock> for each element into <aArray>, starting from <nStart> and continues until <nCount> elements or all array elements have been evaluated (i.e. processed).
The code-block receives two argument values:
1) the current element being evaluated (value may be of whatever type)
2) the numeric position (index) of that element into the array.
Please note that in case the <nCount> exceeding the array elements the function does not issue any kind of 'out of range' error (practically, it means that the number of evaluations may not necessarily be equal to <nCount>). This behavior stands also for other array functions.


AFill(<aArray>,<xValue>,[<nStart>],[<nCount>]) ➔ <aArray>

Assigns the value of <xValue> to the <nCount> elements, beginning at position <nStart>. Multi-dimensional arrays cannot be filled using 'AFill()'. Since Arrays (and Objects) are always passed by reference, the return value is the same as the first parameter.


AIns(<aArray>,[<nPosition>]) ➔ <aArray>

Inserts a new element at <nPosition> into the array <aArray>. All subsequent elements are shifted down by one position so that the last element is lost.
The number of elements remain unchanged. See hb_AIns() which allows auto-sizing of array.


Array(<nDim1>,[...]) ➔ <aArray>

Returns an array dimensioned according to the passed parameters.
All elements of the array contain the value NIL.


AScan(<aArray>,<xSearch>,[<nStart>],[<nCount>]) ➔ <nStoppedAt>

Search into <aArray> for <xSearch> value starting from <nStart> up to <nCount>.
Returns the position of element that matches the searched value or 0 if no match is found.


ASize(<aArray>,<nLength>) ➔ <aArray>

Dynamically increases or decreases the size of <aArray> to <nLength> elements.
When the array is enlarged, new elements are added to the end of <aArray> and are initialized with NIL.
When the number of elements is decreased, elements are removed from the end of <aArray> and their values are lost.
Returns reference to sized array.


ASort(<aArray>,[<nStart>],[<nCount>],[<bSort>]) ➔ <aArray>

Sorts an array entirely or partially. Usage of the code block <bSort> is mandatory when the array is multidimensional, otherwise sorting won't be possible.
The code-block, during the sorting process, receives two elements as block parameters and shall return .T. when they're in order. Example: ASort( aArray, {|x,y| x>y} )

  • Sorting is case sensitive for character elements.
  • Logical value .F. is considered smaller than .T.
  • Order of precedence of different data types:

    • objects, arrays, code-blocks, strings, booleans, timestamps, dates, numbers, hash arrays

    • usage of code-block for sorting arrays with elements of different data type, shall produce RTE without proper handling of block-parameters (i.e., without conversion to same type).


ATail(<aArray>) ➔ <xValue>

Returns the value stored in the last element of <aArray>.


hb_Adel(<@aArray>,[<nElement>],[<lAutoSize>]) ➔ <aArray>

Deletes the value of <nElement> of array <aArray>, moves all the following values to the previous position, and assigns the last element a NIL value. Unlike the legacy ADel() function, hb_ADel() provides a third <lAutoSize> parameter which if specified .T. then the last array element is discarded and _the size of array is decreased by one_, otherwise if <lAutoSize> is .F. or not passed at all, the size of array remains unchanged.


hb_Ains(<@aArray>,[<nPos>],[<uValue>],[<lAutoSize>]) ➔ <aArray>

Inserts <uValue> in the <nPos> position of the array, moving all the items to the next position. If <lAutoSize> is .T., a new element will be added, making room for the previous last element, else the size of <aArray> won't change and the last item of <aArray> will be lost.


hb_ArrayToParams(<aValue>) ➔ <aValue[ 1 ] [, aValue[ N ] ]>

Converts array into list of items which can be used as function parameters, array-values or array-indexes in the same way as ... operator.


hb_AScan(<aArray>,<SearchValue>,[<nStart>],[<nCount>],[<lExact>]) ➔ <nPosition>

Scans the array <aArray> (left to right) trying to locate the <SearchValue>, which can be a simple value or a code block.
Scanning starts either from the 1st or <nStart> element of the <aArray> and continues up to the next <nCount> elements or up to the last element of the array, if no <nCount> specified. When the logical flag <lExact> is specified, overrides the _SET_EXACT setting, which means it directly affects the exactness of comparison.
The function returns the numeric position of the first located element inside the array or 0 (zero), if no matching element found.


hb_ATokens(<cString>,[<cDelimiter>|lEOL>],[<lSkipStrings>],[<lDoubleQuoteOnly>]) ➔ <aTokens>

Returns an array filled with all individual tokens of given <cString> string, that is, all the separate sub-strings that are delimited by either <cDelimiter> or by EOL (end of line) if (instead of <cDelimiter>) <lEOL> has been passed and evaluates to .T.
If neither <cDelimiter> nor <lEOL> specified, then as delimiter is used, by default, an empty space (ASCII char 32).
If <lSkipStrings> is .T. (default=.F.), the quoted sub-strings (if any, inside cString) are not tokenized (i.e. are not searched for <cDelimiter>).
If <lDoubleQuoteOnly> is .T. only the double quote " is considered as a quote sign. This argument is meaningful only when <lSkipStrings>=.T.

  • Notes:
    i. Tokenization is case sensitive, in the (rare) case where <cDelimiter> is a letter-character.
    ii. The delimiters are removed from tokens.*

hb_IsArray(<xExp>) ➔ <lResult>

Determines if <xExp> evaluates to an array value (valtype "A").


hb_IsNull(<xExp>) ➔ <lResult>

Determines if the length of <xExp>, when is a string, an array or a hash, is zero ( Len() == 0 ).


hb_RAScan(<aArray>,<uValue>,[<nStart>],[<nCount>],[<lExact>]) ➔ <nPosition>

Scans (right to left) for <uValue> into <aArray> and returns <nPosition> of found or <zero> if nothing found.
It's same to hb_AScan(...) but it starts scanning reversely, from right to left (or bottom to top.)


RASCAN => hb_RAScan(<aArray>,<uValue>,[<nStart>],[<nCount>],[<lExact>]) ➔ <nPosition>

Scans (right to left) for <uValue> into <aArray> and returns <nPosition> of found or <zero> if nothing found.
It's same to hb_AScan(...) but it starts scanning reversely, from right to left (or bottom to top.)