Livecode Wiki

Parses a string as an number.


variable tString as String
put "5.6" into tString
parse tString as Number -- the result is 5.6
variable tResult as optional String
variable tNum as optional Number
parse "aaaa" as Number into tNum
if tNum is nothing then
  put "unable to parse string" into tResult
end if

Use ParseStringAsNumber when you want to interpret text numerically. The result is nothing if parsing was not possible.