Anonymous user
ABC words: Difference between revisions
m
→{{header|REXX}}: changed a comment, changed wording in the REXX section header.
m (added whitespace.) |
m (→{{header|REXX}}: changed a comment, changed wording in the REXX section header.) |
||
Line 421:
=={{header|REXX}}==
This REXX version doesn't care what order the words in the dictionary are in, nor does it care what
<br>case (lower/upper/mixed) the words are in, the search for the
It also allows the (ABC) characters to be specified on the command line (CL) as well as the dictionary file identifier.
<lang rexx>/*REXX pgm finds "ABC" words (within an identified dict.) where ABC are found in order.*/
parse arg chrs iFID . /*obtain optional arguments from the CL*/
if chrs=='' | chrs=="," then chrs= 'abc' /*Not
if iFID=='' | iFID=="," then iFID='unixdict.txt' /* " " " " " " */
@.= /*default value of any dictionary word.*/
do #=1 while lines(iFID)\==0 /*read each word in the file (word=X).*/
x= strip( linein( iFID) ) /*pick off a word from the input line. */
$.#= x; upper x;
end /*#*/ /* [↑] semaphore name is uppercased. */
say copies('─', 30) # "words in the dictionary file: " iFID
Line 438:
ABCs= 0 /*count of the "ABC" words found. */
do j=1 for #-1 /*process all the words that were found*/
if verify(chrsU,
p= 0 /*initialize the position location. */
do k=1 for L /*examine each letter of the ABC charts*/
_= pos( substr(chrsU, k, 1),
if _<p then iterate j /*Less than the previous? Then skip it*/
p= _ /*save the position of the last letter.*/
|