(* Collection of code snippets by Arne Vajhøj *)
(* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) *)
program CompressDecompress;

{$APPTYPE CONSOLE}

uses
  SysUtils, Zlib;

var
   s1,s2,s3 : string;
   l1,l2,l3 : integer;

begin
  s1 := 'abc123abc123abc123';
  l1 := length(s1);
  CompressBuf(pointer(s1),l1,pointer(s2),l2);
  DecompressBuf(pointer(s2),l2,0,pointer(s3),l3);
  s3 := copy(s3,0,l3);
  writeln(s1,':',l1,'-',l2,'-',l3,':',s3);
  readln;
end.
