how to convert string to val

Monkey Forums/Monkey Programming/how to convert string to val

hardcoal(Posted 2011) [#1]
StringNum$=45

Number=StringNum

results number=45


Raz(Posted 2011) [#2]
Local StringNumber:String = "400"
Local Number:Int = Int(StringNumber)



hardcoal(Posted 2011) [#3]
tnx but what about floating numbers

ah got it .

i use command FLOAT()


Raz(Posted 2011) [#4]
yup :)


therevills(Posted 2011) [#5]
Remember to trim your string when converting to a number for Android or it will crash:

Local StringNumber:String = "400"
Local Number:Int = Int(StringNumber.Trim())


BTW its called "Casting" :)


hardcoal(Posted 2011) [#6]
omg ok