在使用delphi开发程序时候,我们经常会用到strtoint这个函数,该函数主要作用是将指定的整数字符串转换整数,如将'123'转换成123。
但有时候,如果输入'12.3'或'abc',就会导致strtoint出错,为了避免这种情况,我们可以使用:strtointdef这个函数来代替strtoint
Code
var
i :integer;
begin
i := strtointdef('12.3',0);
i := strtointdef('abc',0);
end;
在使用delphi开发程序时候,我们经常会用到strtoint这个函数,该函数主要作用是将指定的整数字符串转换整数,如将'123'转换成123。
但有时候,如果输入'12.3'或'abc',就会导致strtoint出错,为了避免这种情况,我们可以使用:strtointdef这个函数来代替strtoint
Code
var
i :integer;
begin
i := strtointdef('12.3',0);
i := strtointdef('abc',0);
end;
转载于:https://www.cnblogs.com/gis_gps/archive/2008/10/04/1303819.html