Re: Splitting string on blanks in 4GL?
Posted in 1995
My Lit.32 on the subject: one of the few c routines in 4glWorks #include <string.h> int get_token(); get_token() { int i; char *p, *q; char bf[132]; popquote(bf, 132); p=bf; if (!*p) { retquote(""); retquote(""); return(2); } i=strspn(p, " \\t"); if (i==132) { retquote(""); retquote(""); return(2); } p=p+i; i=strcspn(p, " \\t"); q=p+i; *q=0; q++; i=strspn(q, " \\t"); q=q+i; retquote(p); retquote(q); return(2) } the following 4gl code demonstrates its use: define i integer, val array[20] of char(20), str char(100), let i=1 while (str is not null) and (i<21) call get_token(str) returning val[i], str let i=i+1 end while cheers, marco ........................................................................ tear along dotted line! marco greco mar.greco@agora.stm.it Work Achea Srl tel 39 95 503117 / 447828 Pbx Catania, Italy fax 446558