Words containing "the" substring: Difference between revisions

m
→‎{{header|REXX}}: changed some comments, added wording to the REXX section header.
m (added related tasks.)
m (→‎{{header|REXX}}: changed some comments, added wording to the REXX section header.)
Line 166:
 
=={{header|REXX}}==
This REXX version doesn't care what order the words in the dictionary are in,   nor does it care what
<br>case &nbsp;(lower/upper/mixed)&nbsp; the words are in, &nbsp; the search for the substring &nbsp; ''' ''the'' ''' &nbsp; is &nbsp; ''caseless''.
 
It also allows the substring to be specified on the command line (CL) as well as the dictionary file identifier.
<lang rexx>/*REXX program finds words that contain the substring "the" (within an identified dict.)*/
parse arg $ minL iFID . /*obtain optional arguments from the CL*/
Line 175 ⟶ 179:
@.#= strip( linein( iFID) ) /*pick off a word from the input line. */
end /*#*/
$u= $; upper $u /*obtain an uppercase version of chrs$. */
 
say copies('─', 25) # "words in the dictionary file: " iFID
$u= $; upper $u /*obtain an uppercase version of chrs.*/
finds= 0 /*count of the substring found in dict.*/
do j=1 for #-1; z= @.j; upper z /*process all the words that were found*/
if length(z)<minL then iterate /*Is word longtoo enoughshort? No Yes, then skip. */
if pos($u, z)==0 then iterate /*Found the substring? No, then skip. " " */
finds= finds + 1 /*bump count of substring words found. */
say right(left(@.j, 20), 25) /*indent original word for readability.*/