Function Reference

StringIsFloat

Checks if a string is a floating point number.

StringIsFloat ( "string" )

 

Parameters

string The string or expression to check.

 

Return Value

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

 

Remarks

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.

 

Related

StringIsInt, IsFloat

 

Example


StringIsFloat("1.5")  ;returns 1
StringIsFloat("7.")   ;returns 1 since contains decimal
StringIsFloat("-.0")  ;returns 1
StringIsFloat("3/4")  ;returns 0 since '3' slash '4' is not a float

StringIsFloat(1.5)    ;returns 1 since 1.5 converted to string contain .
StringIsFloat(1.0)    ;returns 0 since 1.0 converted to string does not contain .