JavaScript Editor js editor     Web development 



Main Page

Returns a numeric or currency value from a character expression composed of numbers. You can use VAL(В ) to convert the character strings returned by the Visual FoxPro SYS(В ) functions to numeric values.

VAL(cExpression)

Parameters

cExpression


Specifies a character expression composed of up to 16 numbers. Rounding occurs if more than 16 numbers are included in cExpression. If the first character of cExpression is a dollar sign ($),VAL( ) returns a currency value. In all other situations VAL( ) returns a numeric value.

Return Value

Numeric or Currency data type. VAL( ) returns the numbers in the character expression from left to right until a non-numeric character is encountered. Leading blanks are ignored. VAL(В ) returns 0 if the first character of the character expression is not a number, a dollar sign ($), a plus sign (+), or minus sign (-). You can control the result of VAL(В ) by issuing the SET DECIMALS command before using the VAL(В ) function.

Example

В Copy Code
CLEAR
STORE '12' TO A
STORE '13' TO B
? VAL(A) + VAL(B)  && Displays 25.00
STORE '1.25E3' TO C
? 2 * VAL(C)  && Displays 2500.00

See Also



JavaScript Editor js editor     Web development