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

2011-11-28 Thread silvioprog
2011/11/28 Santiago A. : [...] > By the way, I don't have a delphi near to check it. Is tryStrTofloat a fpc > function or it is also a delphi function? If there is such function in > delphi, someone gave up searching help too soon. After F1 on Delphi: = Delphi Object and Component Re

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

2011-11-28 Thread Santiago A.
El vie, 25-11-2011 a las 14:34 +0100, Bart escribió: > On 11/25/11, Santiago A. mailto:s...@ciberpiula.net>> > wrote: > > El 25/11/2011 10:16, Kjow escribió: > > > > What about the standard pascal function "val" > > > > Doesn't Val() use a hardcoded period (.) as decimalseparator? > The StrToFloa

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

2011-11-25 Thread Bart
On 11/25/11, Santiago A. wrote: > El 25/11/2011 10:16, Kjow escribió: > > What about the standard pascal function "val" > Doesn't Val() use a hardcoded period (.) as decimalseparator? The StrToFloat() family uses (Default)FormatSettings AFAIK. Bart -- __

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

2011-11-25 Thread silvioprog
var S: string; F: Double; R: Boolean; begin S := 'A'; R := TryStrToFloat(S, F); end; -- Silvio Clécio === Blog - Twitter - Facebook - LazSolutions - Lazarus-BR - ===    * Conheça nosso canal IRC

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

2011-11-25 Thread Santiago A.
El 25/11/2011 10:16, Kjow escribió: What about the standard pascal function "val" function IsStrFloatNum(s: string): Boolean; var dummyNumber:double; posError:integer; begin val(s, dummyNumber, posError); result:=(posError=0); end; Time ago I came across a program written by someone that ha

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

2011-11-25 Thread Kjow
2011/11/25 Michael Van Canneyt : > > You should use the default TryStrToFloat() function from the sysutils unit. > It does exactly that, without exceptions. > > The function result may change if the internationalization/localization > settings have changed. e.g. if you switch from platform. > > Sec

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

2011-11-25 Thread Michael Van Canneyt
You should use the default TryStrToFloat() function from the sysutils unit. It does exactly that, without exceptions. The function result may change if the internationalization/localization settings have changed. e.g. if you switch from platform. Secondly, please note that in the debugger y

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

2011-11-25 Thread Michael Fuchs
Am 25.11.2011 10:16, schrieb Kjow: Debugger Exception Notification project.exe raised exception class 'EConvertError' with message: "Cross" is an invalid float This happens only if you run it in Lazarus. In this notification window should be a checkbox for ignoring this exception type while de

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

2011-11-25 Thread Kjow
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; begin try // try to convert the string into a floatnumber StrToFloat(s); // if there is no error the result is true Result := True; except