delphi里怎样判断输入字符是否为numeric型,,函数是什么?

来源:百度知道 编辑:UC知道 时间:2024/06/18 01:43:38
.

没有这个函数.不过你可以自己写函数

Function isInteger(s: string): boolean;
Begin
result := CoventDataType(s,'Integer');
End;

Function isFloat(s: string): boolean;
Begin
result := CoventDataType(s,'Float');
End;

function isDate(s: string): boolean;
begin
result := CoventDataType(s,'Date');
End;

function isTime(s: string): boolean;
Begin
result := CoventDataType(s,'Time')
End;

function isDatetime(s: string): boolean;
Begin
result := CoventDataType(s,'A-DateTime'); //A 代表 DateTime 区别于DateTime
End;

Function CoventDataType(S: string; sType: string) : boolean;
Begin
result := false;
try
case Ord(sType[1]) of
65,97 : strtoDateTime(s);//A- dAtetime类型
68,100: StrToDate(S); //D- 'Date' 的ASC码
70,102: StrToFloa