RosettaCodeData/Task/Tokenize-a-string/PL-I/tokenize-a-string.pli

24 lines
507 B
Text
Raw Permalink Normal View History

2015-02-20 00:35:01 -05:00
tok: Proc Options(main);
2013-04-11 01:07:29 -07:00
declare s character (100) initial ('Hello,How,Are,You,Today');
declare n fixed binary (31);
n = tally(s, ',')+1;
begin;
declare table(n) character (50) varying;
declare c character (1);
declare (i, k) fixed binary (31);
table = ''; k = 1;
do i = 1 to length(s);
c = substr(s, i, 1);
if c = ',' then k = k + 1;
else table(k) = table(k) || c;
end;
/* display the table */
table = table || '.';
put skip list (string(table));
end;
2015-02-20 00:35:01 -05:00
end;