Convert string to number
Posted: 26 Nov 2020, 00:17
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?