Words containing "the" substring: Difference between revisions

→‎{{header|Smalltalk}}: misunderstanding in the problem statement
(→‎{{header|Smalltalk}}: changed because the problem statement wasn't clear, but the discussions seems to imply that (sigh))
(→‎{{header|Smalltalk}}: misunderstanding in the problem statement)
Line 668:
=={{header|Smalltalk}}==
{{works with|Smalltalk/X}}
<lang smalltalk>d := 'unixdict.txt' asFilename contents asSet.
page := 'https://www.rosettacode.org/wiki/Words_containing_%22the%22_substring' asURL retrieveContents.
page asCollectionOfWords
select:[:word | (word size > 11) and:[word includesString:'the' caseSensitive:trueOrFalseWhoKnows]]
thenDo:#transcribeCR</lang>
 
Variant (as script file):
{{works with|Smalltalk/X}}
File: "filter.st":
<lang smalltalk>#! /usr/bin/env stx --script
[Stdin atEnd] whileFalse:[
|word|
 
((word := Stdin nextLine) size > 11
and:[word includesString:'the' caseSensitive: trueOrFalseWhoKnows]
) ifTrue:[
Stdout nextPutLine: word
]
]</lang>
Execute with:
<lang shell>chmod +x filter.st
./filter.st < unixdict.txt</lang>
 
{{out}}
<pre>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</pre>
 
=={{header|Wren}}==
Anonymous user