function MyFmt(const S: string): string;
begin
if Length(S) < 3 then
Result := StringOfChar('0', 3 - Length(S)) + S
else
Result := S;
end;
s := MyFmt('1') + MyFmt('10') + MyFmt('100');
就是加前導零嗎
function IntToPreZeroStr(const Value: Integer
const Digits: Byte) : String;
var
str_TmpResult : string;
begin
str_TmpResult := IntToStr(Value);
while Length(str_TmpResult) < digits do
Insert('0' ,str_TmpResult, 1);
Result := str_TmpResult;
end;
function FormatStr(const S: string
X: Integer): string;
begin
if Length(S) < x then
Result := StringOfChar('0', x - Length(S)) + S
else
Result := S;
end;
var
a,b,c: String;
Str: String;
begin
a := Edit1.Text;
b := Edit2.Text;
c := Edit3.Text;
Str := FormatStr(a, 4) + FormatStr(b, 3) + FormatStr(c, 3);
end;