function NumericPrecCheck(compnentCaption,text:string;numericPrec:integer;maxLimit:Integer):string;
  var
     E: extended;
  begin
    Result:='';
    try
      text:=Trim(text);
      E:=StrToFloat(text);
      if E>maxInt then
      begin
        Result:=compnentCaption+'超过范围'+inttostr(maxLimit)+', 请重新输入!';
      end;
      if ( pos( '.', text ) <> 0 ) and ( length( text ) - pos( '.', text ) >numericPrec )  then
      begin
          Result:=compnentCaption+'只能精确到小数点后' + IntToStr( numericPrec ) + '位,请重新输入!';
      end
      else
      begin
          Result:='格式正确';
      end;
    except
       Result:=compnentCaption+'为数字,请重新输入!';
    end;
  end;
 


摘自 edisonfeng