|
AsVal()
Convert a variable of any type containing numbers
to a number.
Syntax
AsVal(<xNumber>,
<lReturnDate>) --> nNumber
Arguments
<xNumber> --> is a variable of any type
to convert.
<lReturnDate> --> pass TRUE to return
date values as date values. This parameter is optional.
Returns
AsVal() returns <xNumber> converted to a
number including decimal digits.
Description
AsVal() is a variable conversion function that
converts a variable of any type containing numeric digits to a
number. When AsVal() is executed, it evaluates <xNumber>
until a second decimal point, the first non-numeric character, or
the end of the string is encountered. Leading spaces are
ignored.
Pass TRUE to the <lReturnDate> parameter to
stop conversion of date values to numeric values. CAPITAL Business
Script allows some mathematical operations on date values such as
adding numbers (days) to a specific date so under some
circumstances such behaviour may be desirable. Otherwise, by
default all values of <xNumber> are converted to
numerics.
As with all other functions that round, digits
between zero and four are rounded down, and digits between five and
nine are rounded up. AsVal() is the opposite of
Str() and
Transform() which convert numeric
values to character strings.
Examples
AsVal('123')
* Result: 123
____________________________
Related Topics
Business
Function List
|