uses StrUtils;
const
ValidChars :string = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
function IncNumb(Numb :string; Len, Base :byte):string;
var
i :integer;
begin
Result := Numb;
if (Result = '') or (Base < 1) or (Base > 36) then Exit;
for i := 1 to Length(Result) do
if not (Result[i] in [ValidChars[1]..ValidChars[Base]]) then Exit;
Result := Dec2Numb(Numb2Dec(Result, Base) + 1, Len, Base);
end;
function IncNumb(Numb, Count :string; Len, Base :byte):string;
var
i :integer;
begin
Result := '';
if (Numb = '') or (Count = '') or (Base < 1) or (Base > 36) then Exit;
for i := 1 to Length(Numb) do
if not (Numb[i] in [ValidChars[1]..ValidChars[Base]]) then Exit;
for i := 1 to Length(Count) do
if not (Count[i] in [ValidChars[1]..ValidChars[Base]]) then Exit;
Result := Dec2Numb(Numb2Dec(Numb, Base) + Numb2Dec(Count, Base), Len, Base);
end;
function DecNumb(Numb :string; Len, Base :byte):string;
var
i :integer;
begin
Result := Numb;
if (Result = '')or (Base < 1) or (Base > 36) then Exit;
for i := 1 to Length(Result) do
if not (Result[i] in [ValidChars[1]..ValidChars[Base]]) then Exit;
Result := Dec2Numb(Numb2Dec(Result, Base) - 1, Len, Base);
if Result = '' then Result := Numb;
end;
function DecNumb(Numb, Count :string; Len, Base :byte):string;
var
i :integer;
begin
Result := '';
if (Numb = '') or (Count = '') or (Base < 1) or (Base > 36) then Exit;
for i := 1 to Length(Numb) do
if not (Numb[i] in [ValidChars[1]..ValidChars[Base]]) then Exit;
for i := 1 to Length(Count) do
if not (Count[i] in [ValidChars[1]..ValidChars[Base]]) then Exit;
Result := Dec2Numb(Numb2Dec(Numb, Base) - Numb2Dec(Count, Base), Len, Base);
end;