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

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  i,ix : integer;
  s : string;
  ss : array [1..3] of string;

begin
  s := 'abc' + chr(13) + chr(10) + 'def' + chr(13) + chr(10) + 'ghi';
  writeln(s);
  ix := 1;
  for i := 1 to length(s) do begin
    if s[i] = chr(13) then begin
        (* nothing *)
    end else if s[i] = chr(10) then begin
       ix := ix + 1;
    end else begin
       ss[ix] := ss[ix] + s[i];
    end;
  end;
  for i := 1 to ix do begin
    writeln(i,' : ',ss[i]);
  end;
end.
