Words containing "the" substring: Difference between revisions

m
→‎{{header|REXX}}: added the computer programming language REXX.
m (→‎{{header|Raku}}: link directly to example)
m (→‎{{header|REXX}}: added the computer programming language REXX.)
Line 160:
northernmost otherworldly parasympathetic physiotherapist physiotherapy psychotherapeutic psychotherapist psychotherapy
radiotherapy southeastern southernmost theoretician weatherbeaten weatherproof weatherstrip weatherstripping </pre>
 
=={{header|REXX}}==
<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*/
if $=='' | $=="," then $= 'the' /*Not specified? Then use the default.*/
if minL=='' | minL=="," then minL= 12 /* " " " " " " */
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).*/
@.#= strip( linein( iFID) ) /*pick off a word from the input line. */
end /*#*/
 
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 long enough? No, 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.*/
end /*j*/
/*stick a fork in it, we're all done. */
say copies('─', 25) finds " words (with a min. length of" ,
minL') that contains the substring: ' $</lang>
{{out|output|text=&nbsp; when using the default inputs:}}
<pre>
───────────────────────── 25105 words in the dictionary file: unixdict.txt
authenticate
chemotherapy
chrysanthemum
clothesbrush
clotheshorse
eratosthenes
featherbedding
featherbrain
featherweight
gaithersburg
hydrothermal
lighthearted
mathematician
neurasthenic
nevertheless
northeastern
northernmost
otherworldly
parasympathetic
physiotherapist
physiotherapy
psychotherapeutic
psychotherapist
psychotherapy
radiotherapy
southeastern
southernmost
theoretician
weatherbeaten
weatherproof
weatherstrip
weatherstripping
───────────────────────── 32 words (with a min. length of 12) that contains the substring: the
</pre>
 
=={{header|Ring}}==