我有一个函数;
type sDirection=(s_Left,s_Right);
function FillStr(sStr, fStr: string; i: integer;sides:sDirection): String;
begin
if sides=s_Left then
begin
while Length(sStr)<i do
sStr:=fStr+sStr;
Result:=sStr;
end
else
begin
while Length(sStr)<i do
sStr:=sStr+fStr;
Result:=sStr;
end;
end;
使用:
ss:=FillStr('123','0',6,s_Left)->'000123'
ss:=FillStr('123','0',6,s_Right)->'123000'