你是不是想实现补“0”的操作并保持数字一共是6位?如果是,可以这样而不用Format函数var
i:integer;//i就是你想要转换的数字
s:string; //s是转换后的数字
begin
i:=...; case i of
0..9 : s:='s00000'+IntToStr(i);
10..99: s:='s0000'+IntToStr(i);
100..999:s:='s000'+IntToStr(i);
1000..9999:s:='s00'+IntToStr(i);
10000..99999:s:='s0'+IntToStr(i);
else s:='s'+IntToStr(i);
end;
end;
i:integer;//i就是你想要转换的数字
s:string; //s是转换后的数字
begin
i:=...; case i of
0..9 : s:='s00000'+IntToStr(i);
10..99: s:='s0000'+IntToStr(i);
100..999:s:='s000'+IntToStr(i);
1000..9999:s:='s00'+IntToStr(i);
10000..99999:s:='s0'+IntToStr(i);
else s:='s'+IntToStr(i);
end;
end;
i:integer;//i就是你想要转换的数字
s:string; //s是转换后的数字
begin
i:=...; case i of
0..9 : s:='s00000'+IntToStr(i);
10..99: s:='s0000'+IntToStr(i);
100..999:s:='s000'+IntToStr(i);
1000..9999:s:='s00'+IntToStr(i);
10000..99999:s:='s0'+IntToStr(i);
else s:='s'+IntToStr(i);
end;
end;
s:string; //s是转换后的数字
s:=Format('%.6d', [i]);jll(你快乐,所以我快乐) 太麻烦了吧