Words containing "the" substring: Difference between revisions
m
fix order
Not a robot (talk | contribs) (Add BASIC) |
Not a robot (talk | contribs) m (fix order) |
||
Line 320:
/Code$ </lang>
=={{header|
<lang basic>10 OPEN "I",1,"unixdict.txt"▼
<lang Lisp>▼
20 IF EOF(1) THEN CLOSE #1: END▼
(defun print-words-containing-substring (str len path)▼
30 LINE INPUT #1,W$▼
(with-open-file (s path :direction :input)▼
40 IF LEN(W$)>11 AND INSTR(W$,"the") THEN PRINT W$▼
(do ((line (read-line s nil :eof) (read-line s nil :eof)))▼
50 GOTO 20</lang>▼
((eql line :eof)) (when (and (> (length line) len)▼
(search str line))▼
(format t "~a~%" line)))))▼
(print-words-containing-substring "the" 11 "unixdict.txt")▼
</lang>▼
{{out}}
<pre>authenticate
Line 363 ⟶ 358:
weatherproof
weatherstrip
weatherstripping</pre>
NIL</pre>▼
=={{header|
▲<lang Lisp>
▲<lang basic>10 OPEN "I",1,"unixdict.txt"
▲(defun print-words-containing-substring (str len path)
▲20 IF EOF(1) THEN CLOSE #1: END
▲ (with-open-file (s path :direction :input)
▲30 LINE INPUT #1,W$
▲ (do ((line (read-line s nil :eof) (read-line s nil :eof)))
▲40 IF LEN(W$)>11 AND INSTR(W$,"the") THEN PRINT W$
▲ ((eql line :eof)) (when (and (> (length line) len)
▲50 GOTO 20</lang>
▲ (search str line))
▲ (format t "~a~%" line)))))
▲(print-words-containing-substring "the" 11 "unixdict.txt")
▲</lang>
{{out}}
<pre>authenticate
Line 404 ⟶ 403:
weatherproof
weatherstrip
weatherstripping
▲NIL</pre>
=={{header|Delphi}}==
|