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

{$APPTYPE CONSOLE}

uses
  SysUtils, StrUtils;

function justfilename(filename : string) : string;

begin
   justfilename := copy(filename, 1, length(filename) - pos('.', reversestring(filename)));
end;

begin
  writeln(justfilename('foobar.dat'));
end.
