Another way, I don't think better ... but, is to loop through each character in
the string if its not numeric break
(0 .. 9 Integer) (0 .. 9 or . Float) (+ & - for Signed stuff) etc.

Regards
Paul

____________________Reply Separator____________________
Subject:  [DUG]:  Numeric test
Author:   [EMAIL PROTECTED]
Date:          20/03/2001 13:42



     Hello,

     I wonder if there is a built-in function or a better way to test a string
     to
     see if its value is numeric then this:

     function IsNumeric(sTemp: String; var bInteger: Boolean): Boolean;
     begin
         Result := True;

         try
           StrToInt(sTemp);
         except
           on E:EConvertError do begin
             try
               StrToFloat(sTemp);
             except
               on E:EConvertError do begin
                 Result := False;
               end;
             end;
           end;
         end;
     end;

     How do I suppress error messages generated by StrTo... so that they do not
     show up.
     I've tried setting NoErrMsg := True but it doesn't work with this function.

     Thank you,
     Sergei Stenkov

     ---------------------------------------------------------------------------
         New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                       Website: http://www.delphi.org.nz
     To UnSub, send email to: [EMAIL PROTECTED]
     with body of "unsubscribe delphi"(See attached file: att1.eml)

att1.eml

Reply via email to