On Wed, Jan 1, 2020 at 6:51 PM Ondrej Pokorny <laza...@kluug.net> wrote:

> If you want to simplify a call, use a class helper:
>
> TStringsHelper = class helper for TStrings
> ...
> procedure TStringsHelper.SaveToFileWithBOM(aFileName: string);
> begin
>    WriteBOM := True;
>    SaveToFile(aFileName);
> end;
>

a bit more accurate version:

procedure TStringsHelper.SaveToFileWithBOM(aFileName: string);
var  prevBom : Boolean;
begin
  prevBom := WriteBOM ;
  try
    WriteBOM := True;
    SaveToFile(aFileName);
  finally
    WriteBom := prevBom;
  end;
end;  :
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to