Anonymous user
Tokenize a string: Difference between revisions
m
→{{header|REXX}}: added wording to a REXX section header, added a better fence for the output, added/changed whitespace and comments, used a template for the output section.
mNo edit summary |
m (→{{header|REXX}}: added wording to a REXX section header, added a better fence for the output, added/changed whitespace and comments, used a template for the output section.) |
||
Line 2,387:
===version 1===
This REXX version doesn't append a period to the last word in the list.
<lang rexx>/*REXX program separates a string of
say 'The input string
new=
do #=1 until
say
{{out|output|text= when using the internal default input:}}
<pre>▼
═════════ Words in the string ══════════
▲say; say 'Words in the string:' /*display a header for the list. */
▲ do j=1 for items /*now, display all the words. */
▲ say a.j || left('.', j\==items) /*append period to word, maybe. */
▲ end /*j*/ /* [↑] don't append "." if last.*/
▲say 'End-of-list.' /*display a trailer for the list.*/
▲ /*stick a fork in it, we're done.*/</lang>
▲<pre>
▲input string = Hello,How,Are,You,Today
Hello.
How.
Line 2,414 ⟶ 2,410:
You.
Today
═════════════ End─of─list ══════════════
</pre>
===version 2===
This REXX version won't work if any of the words have an embedded blank (or possible a tab character) in them, as in:
Hello,Betty Sue,How,Are,You,Today
<lang rexx>/*REXX program to separate a string of comma-delimited words and echo */
sss='Hello,How,Are,You,Today'
Line 2,430 ⟶ 2,429:
End
say 'End-of-list.'</lang>
'''output''' is
=={{header|Ring}}==
|