(* Collection of code snippets by Arne Vajhøj *)
(* (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) *)
type
   pstr = varying [255] of char;
   char32 = packed array [1..32] of char;
   t1 = packed record
           f1 : integer;
           f2 : char32;
        end;
   t1file = file of t1;

function trim(s : char32) : pstr;

var
   i : integer;

begin
   i := length(s);
   while (i > 0) and (s[i] = ' ') do i := i - 1;
   trim := substr(s, 1, i);
end;

