|
Post by bitvast on Aug 29, 2014 8:59:05 GMT 1
I'm looking for a bit of clarification. If the argument to VAL includes characters which don't represent numbers, then it will convert the string representation of the number (if the sting includes one) to a number as long as the number comes first. e.g.
str$ = "27 : widgets" num = VAL(str$) PRINT num
27
But
str$ = "widgets : 27" num = VAL(str$) PRINT num 0
So it seems that the way VAL works is to look for a valid number at the beginning of the string, and if it doesn't find it, it returns 0.
|
|
|
Post by Pjot on Aug 30, 2014 14:09:10 GMT 1
Hi bitvast,
The VAL function relies on the C function 'atof'. From the 'atof' manpage:
So you're right, it is about the beginning of the string.
HTH Peter
|
|