Function Reference


Checks if a string is a floating point number.

StringIsFloat ( "string" )


string The string or expression to check.

Return Value

Success: 1.
Failure: 0 if not floating point format.


A string is a float if it contains at least one decimal digit and exactly one period; the only other character allowed is an optional plus or minus at the beginning. (StringIsFloat() does not accept a comma character as the decimal point even if the computer Locale settings use that symbol.) If parameter is not a string, its value is converted to a string. See examples.


IsFloat, StringIsInt


#include <MsgBoxConstants.au3>

MsgBox($MB_SYSTEMMODAL, "", "Is the string 1.5 a floating point number: " & StringIsFloat("1.5") & @CRLF & _ ; Returns 1, due to the decimal point.
                "Is the string 7. a floating point number: " & StringIsFloat("7.") & @CRLF & _ ; Returns 1, due to the decimal point.
                "Is the string 3/4 a floating point number: " & StringIsFloat("3/4") & @CRLF & _ ; Returns 0, as the string 3 / (forward slash) 4 is not a floating point number.
                "Is the number 1.0 a floating point number: " & StringIsFloat(1.0) & @CRLF & _ ; Returns 1, due to the number to string conversion as well as the decimal point.
                "Is the string 2 a floating point number: " & StringIsFloat("2") & @CRLF) ; Returns 0, due to 2 being an integer.