function Is_Numeric(SS :string ): Boolean ; var i :integer ; begin for i := 0 to Length(ss) do begin if ss[i] not in ['0'...'9' ] then begin Result := False ; Exit ; end ; Result := true ; end ; end ;
function IsNumeric(str: string): boolean; begin result := false; if trim(str) = '.' then result := false else begin try strtofloat(str); result := true; except end; end; end;自己写一个吧
var i :integer ;
begin
for i := 0 to Length(ss) do
begin
if ss[i] not in ['0'...'9' ] then
begin
Result := False ;
Exit ;
end ;
Result := true ;
end ;
end ;
begin
result := false;
if trim(str) = '.' then
result := false
else
begin
try
strtofloat(str);
result := true;
except
end;
end;
end;自己写一个吧
StrtoInt(Str)
Result:=True;
except
Result:=False;
end;
方法多的很关键在与人想
const
def=0;
......var
i:integer;
.....
i:=StrToIntDef(YourStr,def);
if i<>0 then 全是数字
当YourStr输入为‘0’时,算法出错