VAL()

From Lianjapedia
Revision as of 13:25, 4 March 2013 by Yvonne.milne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Purpose

Function to perform character string to numeric conversion

Syntax

VAL(<expC>)

See Also

CAST(), INT(), ROUND(), SET DECIMALS, SET FIXED, STR(), TRANSFORM()

Description

The VAL() function converts the character expression <expC> into a numeric value. If SET FIXED is on, then the value of the string will be rounded to the nearest decimal place according to the SET DECIMALS command. Non-numeric characters are stripped from the string, leaving only digits and the decimal point.

Example

string = "1234"
? val(string)
      1234
set decimals to 2
set fixed on
? val("678.7615")
    678.76
? val("$123,456.78")
 123456.78