Changeset 456 for trunk/Packages/Common/Common.pas
- Timestamp:
- May 30, 2023, 11:31:10 AM (18 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Common.pas
r455 r456 1 unit UCommon;1 unit Common; 2 2 3 3 interface … … 7 7 {$IFDEF UNIX}baseunix,{$ENDIF} 8 8 Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf, Graphics, 9 FileUtil ; //, ShFolder, ShellAPI;9 FileUtil, Generics.Collections; //, ShFolder, ShellAPI; 10 10 11 11 type … … 42 42 clLightRed = TColor($8080FF); 43 43 44 function AddLeadingZeroes(const aNumber, Length : Integer) : string;44 function AddLeadingZeroes(const aNumber, Length : integer) : string; 45 45 function BinToInt(BinStr: string): Int64; 46 46 function BinToHexString(Source: AnsiString): string; … … 65 65 function GetFileFilterItemExt(Filter: string; Index: Integer): string; 66 66 function IntToBin(Data: Int64; Count: Byte): string; 67 function Implode(Separator: Char; List: TList<string>): string; 67 68 function LastPos(const SubStr: String; const S: String): Integer; 68 69 function LoadFileToStr(const FileName: TFileName): AnsiString; … … 96 97 function BinToInt(BinStr : string) : Int64; 97 98 var 98 I : Byte;99 i : byte; 99 100 RetVar : Int64; 100 101 begin 101 102 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); 103 104 RetVar := 0; 104 for I := 1 to Length(BinStr) do begin105 if not (BinStr[ I] in ['0','1']) then begin105 for i := 1 to length(BinStr) do begin 106 if not (BinStr[i] in ['0','1']) then begin 106 107 RetVar := 0; 107 108 Break; 108 109 end; 109 RetVar := (RetVar shl 1) + ( Byte(BinStr[I]) and 1) ;110 RetVar := (RetVar shl 1) + (byte(BinStr[i]) and 1) ; 110 111 end; 111 112 … … 313 314 end; 314 315 316 function Implode(Separator: Char; List: TList<string>): string; 317 var 318 I: Integer; 319 begin 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; 325 end; 326 315 327 {$IFDEF WINDOWS} 316 328 function GetUserName: string; … … 435 447 end; 436 448 437 function AddLeadingZeroes(const aNumber, Length : Integer) : string;449 function AddLeadingZeroes(const aNumber, Length : integer) : string; 438 450 begin 439 451 Result := SysUtils.Format('%.*d', [Length, aNumber]) ; … … 614 626 begin 615 627 for J := ReadFrom to Len do 616 if (S[ J] = C) then628 if (S[j] = C) then 617 629 begin 618 630 Result := J; … … 631 643 Inc(I); 632 644 APos := ReadUntil(I, '<'); 633 Result := Result + Copy(S, I, APos - I);645 Result := Result + Copy(S, I, APos - i); 634 646 I := ReadUntil(APos + 1, '>'); 635 647 end;
Note:
See TracChangeset
for help on using the changeset viewer.