V - Petewg/harbour-core GitHub Wiki
Back to Home
-
Val(
<cNumber>
) ➜ nNumber
converts a string that represents a number to a numeric value.
The function evaluates one-by-one all the numeric digits (including first decimal point and following decimal digits) up to the end of string. If a non-numeric character or a second decimal point is encountered, process stops and the number already formed (if any) is returned. Empty places (space characters) in the beginning of<cNumber>
are ignored.
SET FIXED switch affects the length of decimal places. If is set OFF, all decimal digits in<cNumber>
are returned. If SET FIXED is ON, the number of decimal places is determined by SET DECIMALS. In this case, if DECIMALS set are less than the decimal digits of the number, number is rounded down or up, according formal rounding rule (i.e. digits between zero and four (0...4) are rounded down, and digits between five and nine (5...9) are rounded up).
If<cNumber>
does not represent a number or the first character is not a number, the return value is0
zero.
See also hb_Val() Harbour extension function that can handle/modify the length of returned number. -
ValType(
<exp>
) ➜ cType
returns the value type of the<exp>
(as a constant (litteral) character).
It's similar to Type() function, however, this one can work with LOCAL and STATIC variables and UDFs while Type() cannot.Value types supported by Harbour:
Value Type Character string "C"
Numeric "N"
Date "D"
Boolean (logical) "L"
Memo field "M"
Array "A"
Code-Block "B"
Object "O"
Undefined (NIL) "U"
Hash table (*) "H"
TimeStamp (*) "T"
Pointer to function, procedure or method (*) "P"
Symbolic name (*) "S"
Types marked with (*) are Harbour extensions. -
Version() ➜ cVersion
returns the Harbour version. Seehb_Version()
for more options.