Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-03 - decus/20-0078/libsim/split.sim
There is 1 other file named split.sim in the archive. Click here to see a list.
OPTIONS(/E/C/-Q/-A/-I/-D);
EXTERNAL TEXT PROCEDURE front,rest;
EXTERNAL INTEGER PROCEDURE search;

COMMENT This procedure splits the text T into two halfes - the first
part T1 denoting the part of T up to the text DELIMITER -
and the second part T2 donting the part of T following
the DELIMITER. Thus T1 + DELIMITER + T2 = T. However, if no DELIMITER
is found, T1 will return a reference to the whole of T, while T2 will
return NOTEXT.
;
    PROCEDURE split(t,t1,delimiter,t2);   NAME t1,t2;   TEXT t,t1,t2;
    TEXT delimiter;
    BEGIN
	t.Setpos(1);
	t.Setpos(search(t,delimiter));
	t1:- front(t);
	t.Setpos(t.Pos+delimiter.Length);
	t2:- rest(t);
    END of split;