Need to turn String to Number

BlitzPlus Forums/BlitzPlus Beginners Area/Need to turn String to Number

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

You can covert a float to an int anyway by using Int(Thefloat#).
TwoEyedPete appears to have answered your question already (before) in his link.
Tiger is right too of course. You can only do that assignment because it is a BASIC language otherwise you would have to convert or typecast it. For example trying that (A% = B$) in C would not work, you would need to program it or use a library function. In Delpi you use StrToInt, BUT if raises an exception if the string is not a valid number. Blitz just sets the int to 0.

try this in blitzPLus
f# = 0.55
a% = Int(f#)
Notify (a)

b$ = "51"
a% = b$
Notify (a)