Drat, that was a bad assumption of mine - sorry
I meant it fails for any of E1 or E2 entries
so any entry beginning with E and then a following number
eg: IsNum('E1');
Sorry for the poor example
On 25/02/16 03:54, Vojtěch Čihák wrote:
I tried your function in FPC 3.0.0 in mode ObjFPC and it returns False
for string 'E1/E2/etc'.
V.
______________________________________________________________
> Od: steveg <ste...@nevets.com.au>
> Komu: "FPC-Pascal users discussions" <fpc-pascal@lists.freepascal.org>
> Datum: 24.02.2016 00:57
> Předmět: [fpc-pascal] Possible bug in Numeric test
>
Not sure if this is considered a bug or not :)
I have found this function returns TRUE if passed 'E1/E2/etc'
I am guessing it is seeing the 'E' as exponent
function IsNum( const sSrc :string ) :boolean;
var
Code :integer;
Num :real = 0;
begin
Num := Num;
Val(sSrc, Num, Code);
Exit( Code = 0 );
end;
Thanks - SteveG
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal