Page 1 of 1

Convert string to number

Posted: 26 Nov 2020, 00:17
by madsounds
Is + 0 the only method in AHK to convert string into number?

Code: Select all

str_int := "100"
str_float := "100.0"
MsgBox Type( str_int ) ;String
MsgBox Type( str_float );String

num_int := str_int + 0
num_float_a := str_int + 0.0
num_float_b := str_float + 0
MsgBox Type( num_int ) ;Integer
MsgBox Type( num_float_a ) ;Float
MsgBox Type( num_float_b ) ;Float

MsgBox Type( "100" + 0 ) ;Why this considered error, by the way?

Re: Convert string to number  Topic is solved

Posted: 26 Nov 2020, 10:13
by kczx3