[Lazarus] How to check if a string is a valid floating-point number.

Kjow antispammoni at gmail.com
Fri Nov 25 10:16:49 CET 2011

Hi all,

I need to know if a string is a valid floating-point number, so I
tried this function:

function IsStrFloatNum(s: string): Boolean;
    // try to convert the string into a floatnumber
    // if there is no error the result is true
    Result := True;
    // if there is any error the result is false
    Result := False;

(From: http://www.swissdelphicenter.ch/torry/showcode.php?id=304 )

Well, I get this error:

Debugger Exception Notification
project.exe raised exception class 'EConvertError' with message:
"Cross" is an invalid float

I used this function some month ago in this project and it worked
without problems, but now (some month after) I re-tried to re-build
and re-use this function and I get this error.

Did I inadvertently change something?

Thank you!

More information about the Lazarus mailing list