Val function (LotusScript® Language)

Returns the numeric value represented by a string.

Syntax

Val ( stringExpr )

Elements

stringExpr

Any string expression that LotusScript® can interpret as a numeric value. It can contain any of the following kinds of characters.

  • Digits (0 1 2 3 4 5 6 7 8 9)
  • Other characters in hexadecimal integers (a b c d e f A B C D E F)
  • Sign characters (+ -)
  • Decimal point (.)
  • Exponent characters (E e D d)
  • Prefix characters in binary, octal, and hexadecimal integers (& B O H)
  • Suffix type characters (% & ! # @)

Return value

Val returns the converted part of stringExpr as a Double.

Usage

Val strips out spaces, tabs, carriage returns, and newlines from stringExpr. It starts converting from the beginning of the string and stops when it encounters a character other than those listed for stringExpr in the preceding list.

Note: If the string being evaluated is a hexidecimal number between 8000 and FFFF, both the prefix (&H) and suffix (&) must be used. Hexidecimal numbers between 0 and 7FFF may use just the prefix (&H) or both the prefix (&H) and suffix (&).

Example