Words containing "the" substring: Difference between revisions

m (→‎{{header|Smalltalk}}: ouch undid one too many...)
Line 673:
select:[:word | (word size > 11) and:[word includesString:'the' caseSensitive:trueOrFalseWhoKnows]]
thenDo:#transcribeCR</lang>
 
if counting is required, keep bag:
<lang smalltalk>bagOfWords := Bag new.
'unixdict.txt' asFilename contents
select:[:word | (word size > 11) and:[word includesString:'the' caseSensitive:trueOrFalseWhoKnows]]
thenDo:[:word | bagOfWords add:word. word transcribeCR].
bagOfWords transcribeCR</lang>
 
Note: #transcribeCR is a method in Object which says: "Transcript showCR:self".
 
{{works with|Smalltalk/X}}
Anonymous user