Words containing "the" substring: Difference between revisions
Content added Content deleted
m (→{{header|Smalltalk}}: ouch undid one too many...) |
|||
Line 673: | Line 673: | ||
select:[:word | (word size > 11) and:[word includesString:'the' caseSensitive:trueOrFalseWhoKnows]] |
select:[:word | (word size > 11) and:[word includesString:'the' caseSensitive:trueOrFalseWhoKnows]] |
||
thenDo:#transcribeCR</lang> |
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}} |
{{works with|Smalltalk/X}} |