Difference between revisions of "VAL()"
From Lianjapedia
Yvonne.milne (Talk | contribs) m (1 revision) |
Yvonne.milne (Talk | contribs) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Function to perform character string to numeric conversion | Function to perform character string to numeric conversion | ||
− | |||
==Syntax== | ==Syntax== | ||
VAL(<expC>) | VAL(<expC>) | ||
− | |||
==See Also== | ==See Also== | ||
[[CAST()]], [[INT()]], [[ROUND()]], [[SET DECIMALS]], [[SET FIXED]], [[STR()]], [[TRANSFORM()]] | [[CAST()]], [[INT()]], [[ROUND()]], [[SET DECIMALS]], [[SET FIXED]], [[STR()]], [[TRANSFORM()]] | ||
− | |||
==Description== | ==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. | + | 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== | ==Example== | ||
Line 24: | Line 20: | ||
? val("678.7615") | ? val("678.7615") | ||
678.76 | 678.76 | ||
+ | ? val("$123,456.78") | ||
+ | 123456.78 | ||
</code> | </code> | ||
− | |||
− | |||
− | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
− | [[Category: | + | [[Category:Formatting Functions]] |
− | + |
Latest revision as of 13:25, 4 March 2013
Contents
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