您的位置:首页 > 其它

判断字符是否为整数、浮点型小数、字符串

2016-08-17 08:23 253 查看
function TForm_fangyuanhuizong_tubiao.IsNumber(s: string): integer; //判断是否为整数、浮点型小数、字符串
var
i : integer;
begin
result := 2;
for i := 1 to Length(s) do
begin
if (s[i] < '0') or (s[i] > '9') then
begin
if (s[i] = '.') and (i <> 1) and (i <> Length(s)) then
begin
if result = 1 then
begin
result := 2;
Exit;
end;
result := 1;
continue;
end;

exit;
end;
end;
if result <> 1 then result := 0;

//返回 0 -- integer 1 -- double 2 ---string
end;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐