A function which converts a character string representing a number into numeric form.


VAL makes the best sense it can of its argument. If the argument starts with numeric characters (with or without a preceding sign), VAL will work from left to right until it meets a non numeric character. It will then 'give up' and return what it has got so far. If it can't make any sense of its argument, it returns zero.

For example,

PRINT VAL("-123.45.67ABC")

would print



PRINT VAL("A+123.45")

would print


VAL will NOT work with hexadecimal numbers. You must use EVAL to convert hexadecimal number strings.



Associated Keywords