Ignore:
Timestamp:
May 14, 2024, 5:18:30 PM (6 months ago)
Author:
chronos
Message:
  • Modified: Updated Common package.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/Common.pas

    r554 r574  
    6565function GetFileFilterItemExt(Filter: string; Index: Integer): string;
    6666function IntToBin(Data: Int64; Count: Byte): string;
    67 function Implode(Separator: Char; List: TList<string>): string;
     67function Implode(Separator: string; List: TList<string>): string;
     68function Implode(Separator: string; List: TStringList; Around: string = ''): string;
    6869function LastPos(const SubStr: String; const S: String): Integer;
    6970function LoadFileToStr(const FileName: TFileName): AnsiString;
     
    184185(*function DelTree(DirName : string): Boolean;
    185186var
    186   SHFileOpStruct: TSHFileOpStruct;
    187   DirBuf: array [0..255] of Char;
     187  SHFileOpStruct : TSHFileOpStruct;
     188  DirBuf : array [0..255] of char;
    188189begin
    189190  DirName := UTF8Decode(DirName);
    190191  try
    191     FillChar(SHFileOpStruct, Sizeof(SHFileOpStruct), 0);
    192     FillChar(DirBuf, Sizeof(DirBuf), 0 );
    193     StrPCopy(DirBuf, DirName);
     192    Fillchar(SHFileOpStruct,Sizeof(SHFileOpStruct),0) ;
     193    FillChar(DirBuf, Sizeof(DirBuf), 0 ) ;
     194    StrPCopy(DirBuf, DirName) ;
    194195    with SHFileOpStruct do begin
    195196      Wnd := 0;
     
    200201      fFlags := fFlags or FOF_SILENT;
    201202    end;
    202     Result := (SHFileOperation(SHFileOpStruct) = 0);
     203    Result := (SHFileOperation(SHFileOpStruct) = 0) ;
    203204  except
    204     Result := False;
     205     Result := False;
    205206  end;
    206207end;*)
     208
     209function Implode(Separator: string; List: TStringList; Around: string = ''): string;
     210var
     211  I: Integer;
     212begin
     213  Result := '';
     214  for I := 0 to List.Count - 1 do begin
     215    Result := Result + Around + List[I] + Around;
     216    if I < List.Count - 1 then Result := Result + Separator;
     217  end;
     218end;
    207219
    208220function LastPos(const SubStr: String; const S: String): Integer;
     
    314326end;
    315327
    316 function Implode(Separator: Char; List: TList<string>): string;
     328function Implode(Separator: string; List: TList<string>): string;
    317329var
    318330  I: Integer;
Note: See TracChangeset for help on using the changeset viewer.