QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: acjacques on October 20, 2019, 08:53:06 pm
-
What explain this?
x$ = "1234"
LOCATE 1, 10
PRINT "string="; x$
LOCATE 2, 10
mynumber = VAL(x$) 'string to number
PRINT "number="; mynumber 'I don't know why have one more space here when priting
-
What explain this?
x$ = "1234"
LOCATE 1, 10
PRINT "string="; x$
LOCATE 2, 10
mynumber = VAL(x$) 'string to number
PRINT "number="; mynumber 'I don't know why have one more space here when priting
Placeholder for the sign.
Think of how the values would line up if x$ was “-1234”
-
OK. You are right.
to check i have changed the lines:
x$ = "-1234"
and
PRINT "number="; -mynumber
-
Here is one from my toolbox for that PITA:
FUNCTION ts$
(number
) 'ts stands for trim string
no charge!