Anonymous user
Tokenize a string: Difference between revisions
m
→{{header|REXX}}: added needed 1st statement for REXX programs. -- ~~~~
m (→version 1: legitimized the REXX program's 1st statement. -- ~~~~) |
m (→{{header|REXX}}: added needed 1st statement for REXX programs. -- ~~~~) |
||
Line 1,366:
=={{header|REXX}}==
===version 1===
<lang rexx>/*REXX program to seperate a string of comma-delimited words, and echo. */
sss='Hello,How,Are,You,Today' /*words seperated by commas (,).
say 'input string='sss /*
new=sss /*make a copy of the string. */▼
▲new=sss /*make a copy of the string. */
do items=1 until new=='' /*keep going until SSS is empty. */
parse var new a.items ',' new /*parse words delinated by comma.*/
end
say; say 'Words in the string:'
do k=1 for items /*Now, display all the words. */
say a.k'.' /*append a period to the word. */
end
say 'End-of-list.' /*Display a trailer for the list.*/</lang>
'''output'''
<pre style="height:30ex;overflow:scroll">
</pre>
===version 2===
<lang rexx>
say 'input string='sss /*display the original string. */
say; say 'Words in the string:'
do until sss=='' /*keep going until SSS is empty. */
Line 1,406:
say 'End-of-list.' /*Display a trailer for the list.*/</lang>
<br>
=={{header|Ruby}}==
|