Anonymous user
Tokenize a string: Difference between revisions
→{{header|Modula-3}}: Proper version, old version just used 5 for array bounds, this version dynamically allocates the required size.
No edit summary |
(→{{header|Modula-3}}: Proper version, old version just used 5 for array bounds, this version dynamically allocates the required size.) |
||
Line 341:
IMPORT IO, TextConv;
VAR tokens: Texts;
string := "Hello,How,Are,You,Today";
sep := SET OF CHAR {','};
BEGIN
tokens := NEW(Texts, TextConv.
TextConv.Explode(string, tokens^, sep);
FOR i := FIRST(tokens^) TO LAST(tokens^) DO
IO.Put(tokens[i] & ".");
END;
|