Need val func that works

BlitzPlus Forums/BlitzPlus Beginners Area/Need val func that works

Zooker(Posted 2005) [#1]
I need to change strings to numbers. I downloaded a function VAL# that's supposed to work but I can't get it to work. This is very important because I'm re-writing a check register program so that it has more features.(I originaly wrote in basic 7.1.)Where can I get a val function that works?


Yan(Posted 2005) [#2]
Blitz will auto-convert between variable types for you, most of the time...
a$ = "10"
b = a$
c# = "42.5678"

print a
print b
print c#
print int("30") + int(a$); Notice I force the conversion to integer here
                         ; to ensure an addition rather than a string concatenation!



CoderX(Posted 2005) [#3]
Use blitz's int() function:
 number = int(string$)
Edit: Whoops... Pete already mentioned it :)


Zooker(Posted 2005) [#4]
Thanx!