function setlen(TmpStr:string;TmpChr:char;TmpLen:integer;const TmpFlag:integer):string;
begin
case Tmpflag of
0: Result := StringOfChar(TmpChr,TmpLen-Length(TmpStr)) + TmpStr;
1: Result := TmpStr + StringOfChar(TmpChr,TmpLen-Length(TmpStr));
end;
end;
funciton cc(bw,ss:sting):string/bw就是你设置00 ss就是ab
var
i,m,n:intger;
sbw:string;
begin
sbw:=bw;
bw:='';
m:=8;
i:=Length(ss);
for n:=0 to m-i do
begin
bw:=bw+sbw;
end;
ss:=bw+ss;
result:=ss;
end;
补充一下:
var x:char; //要补的字符
var k:string;// 要补的方向
var s:string;//被补的字符串
var i:string; //总位数
if k='左' then while length(s)<i do s:=x+s;
if k='右' then while length(s)<i do s:=s+x;