Ignore:
Timestamp:
Aug 31, 2018, 3:38:01 PM (6 years ago)
Author:
chronos
Message:
  • Modified: Updated Common package files.
  • Fixed: Autosize coolbar during main form resize.
File:
1 edited

Legend:

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

    r187 r200  
    7272function MergeArray(A, B: array of string): TArrayOfString;
    7373function LoadFileToStr(const FileName: TFileName): AnsiString;
     74procedure SaveStringToFile(S, FileName: string);
    7475procedure SearchFiles(AList: TStrings; Dir: string;
    7576  FilterMethod: TFilterMethodMethod = nil);
    7677function GetStringPart(var Text: string; Separator: string): string;
     78function StripTags(const S: string): string;
    7779function PosFromIndex(SubStr: string; Text: string;
    7880  StartIndex: Integer): Integer;
     
    527529end;
    528530
     531procedure SaveStringToFile(S, FileName: string);
     532var
     533  F: TextFile;
     534begin
     535  AssignFile(F, FileName);
     536  try
     537    ReWrite(F);
     538    Write(F, S);
     539  finally
     540    CloseFile(F);
     541  end;
     542end;
     543
    529544procedure SearchFiles(AList: TStrings; Dir: string;
    530545  FilterMethod: TFilterMethodMethod = nil);
     
    561576  Result := Trim(Result);
    562577  Text := Trim(Text);
     578end;
     579
     580function StripTags(const S: string): string;
     581var
     582  Len: Integer;
     583
     584  function ReadUntil(const ReadFrom: Integer; const C: Char): Integer;
     585  var
     586    J: Integer;
     587  begin
     588    for J := ReadFrom to Len do
     589      if (S[j] = C) then
     590      begin
     591        Result := J;
     592        Exit;
     593      end;
     594    Result := Len + 1;
     595  end;
     596
     597var
     598  I, APos: Integer;
     599begin
     600  Len := Length(S);
     601  I := 0;
     602  Result := '';
     603  while (I <= Len) do begin
     604    Inc(I);
     605    APos := ReadUntil(I, '<');
     606    Result := Result + Copy(S, I, APos - i);
     607    I := ReadUntil(APos + 1, '>');
     608  end;
    563609end;
    564610
     
    608654end;
    609655
     656
    610657initialization
    611658
Note: See TracChangeset for help on using the changeset viewer.