Ignore:
Timestamp:
May 30, 2023, 11:31:10 AM (11 months ago)
Author:
chronos
Message:
  • Modified: Removed U prefix from unit names.
File:
1 moved

Legend:

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

    r455 r456  
    1 unit UCommon;
     1unit Common;
    22
    33interface
     
    77  {$IFDEF UNIX}baseunix,{$ENDIF}
    88  Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf, Graphics,
    9   FileUtil; //, ShFolder, ShellAPI;
     9  FileUtil, Generics.Collections; //, ShFolder, ShellAPI;
    1010
    1111type
     
    4242  clLightRed = TColor($8080FF);
    4343
    44 function AddLeadingZeroes(const aNumber, Length : Integer) : string;
     44function AddLeadingZeroes(const aNumber, Length : integer) : string;
    4545function BinToInt(BinStr: string): Int64;
    4646function BinToHexString(Source: AnsiString): string;
     
    6565function GetFileFilterItemExt(Filter: string; Index: Integer): string;
    6666function IntToBin(Data: Int64; Count: Byte): string;
     67function Implode(Separator: Char; List: TList<string>): string;
    6768function LastPos(const SubStr: String; const S: String): Integer;
    6869function LoadFileToStr(const FileName: TFileName): AnsiString;
     
    9697function BinToInt(BinStr : string) : Int64;
    9798var
    98   I : Byte;
     99  i : byte;
    99100  RetVar : Int64;
    100101begin
    101102  BinStr := UpperCase(BinStr);
    102   if BinStr[Length(BinStr)] = 'B' then Delete(BinStr,Length(BinStr),1);
     103  if BinStr[length(BinStr)] = 'B' then Delete(BinStr,length(BinStr),1);
    103104  RetVar := 0;
    104   for I := 1 to Length(BinStr) do begin
    105     if not (BinStr[I] in ['0','1']) then begin
     105  for i := 1 to length(BinStr) do begin
     106    if not (BinStr[i] in ['0','1']) then begin
    106107      RetVar := 0;
    107108      Break;
    108109    end;
    109     RetVar := (RetVar shl 1) + (Byte(BinStr[I]) and 1) ;
     110    RetVar := (RetVar shl 1) + (byte(BinStr[i]) and 1) ;
    110111  end;
    111112
     
    313314end;
    314315
     316function Implode(Separator: Char; List: TList<string>): string;
     317var
     318  I: Integer;
     319begin
     320  Result := '';
     321  for I := 0 to List.Count - 1 do begin
     322    Result := Result + List[I];
     323    if I < List.Count - 1 then Result := Result + Separator;
     324  end;
     325end;
     326
    315327{$IFDEF WINDOWS}
    316328function GetUserName: string;
     
    435447end;
    436448
    437 function AddLeadingZeroes(const aNumber, Length : Integer) : string;
     449function AddLeadingZeroes(const aNumber, Length : integer) : string;
    438450begin
    439451  Result := SysUtils.Format('%.*d', [Length, aNumber]) ;
     
    614626  begin
    615627    for J := ReadFrom to Len do
    616       if (S[J] = C) then
     628      if (S[j] = C) then
    617629      begin
    618630        Result := J;
     
    631643    Inc(I);
    632644    APos := ReadUntil(I, '<');
    633     Result := Result + Copy(S, I, APos - I);
     645    Result := Result + Copy(S, I, APos - i);
    634646    I := ReadUntil(APos + 1, '>');
    635647  end;
Note: See TracChangeset for help on using the changeset viewer.