Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Tokenize-a-string/REXX/tokenize-a-string-1.rexx
Normal file
13
Task/Tokenize-a-string/REXX/tokenize-a-string-1.rexx
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/*REXX program separates a string of comma─delimited words, and echoes them ──► terminal*/
|
||||
original = 'Hello,How,Are,You,Today' /*some words separated by commas (,). */
|
||||
say 'The input string:' original /*display original string ──► terminal.*/
|
||||
new= original /*make a copy of the string. */
|
||||
do #=1 until new=='' /*keep processing until NEW is empty.*/
|
||||
parse var new @.# ',' new /*parse words delineated by a comma (,)*/
|
||||
end /*#*/ /* [↑] the new array is named @. */
|
||||
say /* NEW is destructively parsed. [↑] */
|
||||
say center(' Words in the string ', 40, "═") /*display a nice header for the list. */
|
||||
do j=1 for # /*display all the words (one per line),*/
|
||||
say @.j || left(., j\==#) /*maybe append a period (.) to a word. */
|
||||
end /*j*/ /* [↑] don't append a period if last. */
|
||||
say center(' End─of─list ', 40, "═") /*display a (EOL) trailer for the list.*/
|
||||
12
Task/Tokenize-a-string/REXX/tokenize-a-string-2.rexx
Normal file
12
Task/Tokenize-a-string/REXX/tokenize-a-string-2.rexx
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/*REXX program to separate a string of comma-delimited words and echo */
|
||||
sss='Hello,How,Are,You,Today'
|
||||
say 'input string='sss
|
||||
say ''
|
||||
say 'Words in the string:'
|
||||
ss =translate(sss,' ',',')
|
||||
dot='.'
|
||||
Do i=1 To words(ss)
|
||||
If i=words(ss) Then dot=''
|
||||
say word(ss,i)dot
|
||||
End
|
||||
say 'End-of-list.'
|
||||
Loading…
Add table
Add a link
Reference in a new issue