VAL
(Function)
Converts a character string to a numeric value.
VAL (<Character string >)
This statement converts a character string designated in <Character string> to a numeric value.
If the first character of <character string> is not +, -, &, or numeric value, VAL becomes 0.
If the system finds a character other than the figures in the character string, the Val Function stops reading. The Val function does not interpret symbols or letters which are normally regarded as part of a numeric value such as the yen symbol (\) or comma (,). However, the Val function does recognizes prefixes &H (hexadecimal number) and &B (binary number). Blanks, tabs and line feeds in the character string of an argument are ignored.
DEFINT li1, li2, li3
|
|
li1 = VAL("&B100")
|
'Converts "&B100" to a numeric value
'(4 in decimal) and assigns it to li1.
|
li2 = VAL("&H20")
|
'Converts "&H20" to a numeric value
'(32 in decimal) and assigns it to li2.
|
li3 = VAL("-30")
|
'Converts "-30" to a numeric value (-30 in decimal)
'and assigns it to li3.
|