(* 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;

function trim(s : packed array[$u..$l:integer] of char) : pstr;

var
   i : integer;

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