function split(S, Sep: AnsiString): sptype;
var
  I, L,J: Integer;
  Left: AnsiString;
begin
  J:=0;
  L := Length(Sep);
  I := Pos(Sep, S);
  while (I > 0) do
  begin
    Left := leftstr(S, I-1);
    inc(J);
    setlength(Result,J);
    Result[J-1]:=Left;
    Delete(S, 1, I + L - 1);
    I := Pos(Sep, S);
  end;
  if S <> '' then
   begin
   inc(J);
   setLength(Result,J);
   Result[J-1]:=S;
   end;
end;