A - Petewg/harbour-core GitHub Wiki
Back To Home
-
AAdd(
<aArray>, [<xValue>]
) β xValue|NIL
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, orNIL
.
Note that the presence of the 2nd argument (or at least the comma next to the 1st one, in which caseNIL
is implied asxValue
) 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 toASize(aArray, Len(aArray)+1)
. -
Abs(
<nExp>
) β nPositive
returns the absolute value of the passed argument. The result is always greater than or equal to0
(zero). -
AChoice(
<nTop>,<nLeft>,<nBottom>,<nRight>,<acMenuItems>,[<xSelect>],[<xUserFunction>],[<nPos>],[<nHiLiteRow>]
) β nItemSelected
displays a Pop-up-like menu with selectable menu items, waiting for a selection by user. Returns the index number of the selected item, which is the ordinal position of the item into the array; if the selection aborted, (when for example, the Esc key pressed) the value returned is0
(zero).-
<acMenuItems>
is an array of character strings to display as the menu items. -
<xSelect>
is used to determine whether one or more menu items will be selectable or not! It can be either:- a parallel array of logical or character values, one element for each item in
<acMenuItems>
. If the element is a character string, it is evaluated as a macro expression which should evaluate to a logical data type. - or a single logical value, in which case all menu items will be either available when
.T.
or unavailable when.F.
; default is.T.
(i.e., all items be available). - or codeblocks, function pointers or character expression, being supplied both 'as is' or 'as an array'.
When passed as a single value and the next parameter
<xUserFunction>
is empty, it's being used as<xUserFunction>
(surrogate), while all the items become selectable. This is a new Harbour extension!
- a parallel array of logical or character values, one element for each item in
-
<xUserFunction>
is the name of a user-defined function or a function Symbol or a Code-block that executes when an unrecognizable key is pressed. Must be noted that the behavior of Achoice() is significantly affected by the presence or not of this argument. Refer to Clipper Reference Guide for more... -
<nPos>
is the position in the<acMenuItems>
array of the item that will be highlighted when the menu is initially displayed. -
<nHiLiteRow>
is the zero-based number of the window row on which the initial menu item will appear.
-
-
AClone(
<aSource>
) β aDuplicate
duplicates an array. 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.
(note: that's a hbMisc contrib library function) -
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 valueNIL
. See hb_Adel() for extra functionality. -
ADir(
[<cFileSpec>], [<aFilenames>], [<aSizes>], [<aDates>], [<aTimes>], [<aAttributes>]
) β nFiles
depreciated compatibility function! useDirectory()
orhb_Directory()
instead. -
AddMonth(
[<dDate>,] <nMonths>
) β dShiftedDate
(note: that's a hbct contrib library function) -
AEval(
<aArray>, <bBlock>, [<nStart>], [<nCount>]
) β aArray
Evaluates the<bBlock>
for each element into<aArray>
, starting from<nStart>
and continues until<nCount>
[1] elements or all array elements have been evaluated (i.e. processed).
Default values for<nStart> & <nCount>
parameters are:nStart=1
,nCount=Len(aArray)
.
The code-block receives two argument values: 1) the current element being evaluated (value may be of whatever type) and 2) the numeric position (index) of that element into the array.
Example:AEval( aArray, {|e,n| Qout(n, e)} )
[1] 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. -
AFields(
[<aFieldsnames>], [<aTypes>], [<aWidths>], [<aDecimals>], [<aFlags>]
) β nFields
depreciated compatibility function! use 'DbSTruct()' which retrieves all structural information in a multi-dimensional array. -
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()'. Default values for<nStart>/<nCount>
optional parameters:<nStart>
= 1,<nCount>
= Len( aArray ) (i.e. all elements). -
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. -
Alert(
<cMessage>, [<aOptions>]
) β nChoice
displays a simple modal dialog box with a message and one or more options the user can select.<cMessage>
is the message text displayed. If it contains one or more semicolons;
the text after each semicolon is displayed at the next (new) line.<aOptions>
defines a list of up to 4 possible options. the function returns a numeric value indicating which option was chosen. If theEsc
key was pressed, returns0
(zero). -
Alias(
[<nWorkarea>]
) β cAlias | ""
returns the alias of the<nWorkArea>
or the alias of the current work area if<nWorkArea>
is not provided. If no database file is opened in current or given work area, it returnsnull
string.
(NOTE: if no explicit alias specified during opening, the default alias of the opened dbf, is the filename without path and extension.) -
AllTrim(
<cString>
) β cTrimString
removes all the leading and trailing spaces from the<cString>
.
Note: Thecarriage return
,line feed
andtab
characters (i.e.Chr(13), Chr(10), Chr(9)
respectively) are treated as space characters and are removed. However, other non-printable character (i.e. those below ASCIIChr(32)
) are not affected and this fact may be important, particularly withChr(0)
, which might cause "unexpected" behavior when the supposedly trimmed string is passed to functions likeEmpty()
. -
AltD(
[<nAction>]
) β NIL
Invokes debugger. Optional argument[<nAction>]
can be1=enable debuger
or0=disable debugger
. In order the debugger to be activated, the-b
compiler switch must have been used during building. -
AMPM(
[<cTime>]
) β cTime
returns the[<cTime>]
time string in 12-hour format (HH:MM:SS pm/am
), that is, the hour (HH
) part is displayed as a<=
12
value and an added suffix which is eitheram
if[<cTime>]
is an 'ante meridiem' (before midday) hour orpm
if it is 'post meridiem' (after midday). If[<cTime>]
is not given the function returns12 am
. -
AMonths() β aMonths
returns an array with all the months names in the selected current language. -
Array(
<nDim1> [, <nDimN,...>]
) β aArray
returns an array dimensioned according to the passed parameters. All elements of the array contain the valueNIL
. -
Asc(
<cExp>
) β nCode
returns theASCII
value of the leftmost character of any character expression. -
AScan(
<aArray>, <xSearch>, [<nStart>], [<nCount>]
) β nStoppedAt
search into<aArray>
for<xSearch>
value starting from<nStart>
up to<nCount>]
. (default values are:nStart=1
,nCount=All elements
).
returns the position of element that matches the searched value or0
if no match is found. See also hb_AScan() -
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 withNIL
. 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. Examples:// Ascending sorting of the array aArray aArray := ASort( aArray,,, { |x,y| x < y } ) // Descending sorting of a multidimensional array based on 3rd sub-array element. aArray := ASort( aArray,,, { |x,y| x[3] > y[3] } )
- 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
- any attempt of sorting arrays with elements of different data type, shall produce RTE if actualized without proper handling of block-parameters (i.e., without conversion to same type).
-
At(
<cSearchFor>, <cIntoString>
) β nPosition
returns the position in<cIntoString>
where<cSearchFor>
is found or0
(zero) when<cSearchFor>
is not found. NOTE: Search is case sensitive! -
ATail(
<aArray>
) β xValue
returns the value stored in the last element of<aArray>
.
Back to top
Back to Home