Changeset 146 for Common


Ignore:
Timestamp:
Jan 26, 2011, 7:28:29 AM (14 years ago)
Author:
george
Message:
  • Fixed: Freeing micro threads on finish.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Common/UCommon.pas

    r129 r146  
    4242function AddLeadingZeroes(const aNumber, Length : integer) : string;
    4343function LastPos(const SubStr: String; const S: String): Integer;
     44function GenerateNewName(OldName: string): string;
    4445
    4546implementation
     47
     48function GenerateNewName(OldName: string): string;
     49var
     50  I: Integer;
     51  Number: Integer;
     52begin
     53  Number := 1;
     54  // Find number on end
     55  if Length(OldName) > 0 then begin
     56    I := Length(OldName);
     57    while (I > 1) and ((OldName[I] >= '0') and (OldName[I] <= '9')) do Dec(I);
     58    TryStrToInt(Copy(OldName, I + 1, Length(OldName) - I), Number);
     59    Inc(Number)
     60  end;
     61  Result := Copy(OldName, 1, I) + IntToStr(Number);
     62end;
    4663
    4764(*function DelTree(DirName : string): Boolean;
Note: See TracChangeset for help on using the changeset viewer.