去掉整数前面多余的0

var
str, lstmpdata, temp: string;
begin
// str := '00030.0';
// str := '00.2';
lstmpdata := '<0020.0';
if (Copy(lstmpdata,1,1)='>' )Or (Copy(lstmpdata,1,1)='<') then
begin
temp:= Copy(lstmpdata,1,1) ;
lstmpdata:= Copy(lstmpdata,2,length(lstmpdata)-1) ;
ShowMessage(lstmpdata);
ShowMessage(Copy(lstmpdata, 1, 1));
ShowMessage(Copy(lstmpdata, 2, 1));
end;

while (Copy(lstmpdata, 1, 1) = '0') and (Copy(lstmpdata, 2, 1) <> '.') do
begin
lstmpdata := copy(lstmpdata, 2, length(lstmpdata) - 1);
end;
lstmpdata:=temp+lstmpdata ;
ShowMessage(lstmpdata);
end;

原文地址:https://www.cnblogs.com/semth/p/10677187.html