- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi IsNumeric 判断字符串是否为数字
IsNumeric 判断字符串是否为数字,如果是数字返回true,如果包含有汉字或字符的话返回false. 由于Delphi本身没有IsNumeric这个函数,不像其它语言,这个函数相当于Java的IsNaN函数。
delphi代码
function IsNumeric(AStr: string): Boolean;
var
Value: Double;
Code: Integer;
begin
Val(AStr, Value, Code);
result := Code = 0;
end;