function IncNum(const NumberStr: string): string;
var
i, num: Integer;
numstr: string;
IsIn: Boolean;
begin
IsIn := True;;
numstr := NumberStr;
for i := Length(numstr) downto 1 do
begin
if numstr[i] in ['0'..'9'] then
begin
if not isin then Continue;
isin := False;
num := StrToInt(numstr[i]);
num := num + 1;
if num = 10 then
begin
num := 0;
IsIn := True;
end;
numstr[i] := inttostr(num)[1];
end;
end;
Result := numstr;
end;
方案2
s1:= 'JD-201206001';
s2:=format('JD-201206%.3d',[strtoint(copy(s1,10,3))+1]);