11 Replies Latest reply on Mar 1, 2015 1:11 AM by BoTa_264741

    Convert string to number, e.g. float with error handling


       While receiving UART commands, I need to convert strings to numerical values. For example, string "1.23" would produce float number 1.23 using function 'atof()':






      Unfortunately, in the case of a typo this function will return a valid number also ("0"), which will be passed to the program. For example:




      atof('1.$23…')=0,    ($ is a typo)




      Is there any built-in function to check for valid input number?