String matching: Difference between revisions
Content added Content deleted
Line 1,425: | Line 1,425: | ||
(ends-with str "ghi") |
(ends-with str "ghi") |
||
;; |
;; find all positions of pattern inside str |
||
(define ( |
(define (find-all-pos pattern str) |
||
(let ((idx -1) (pos '())) |
(let ((idx -1) (pos '())) |
||
(while (setq idx (find pattern str 0 (+ idx 1))) |
(while (setq idx (find pattern str 0 (+ idx 1))) |
||
(push idx pos -1)))) |
(push idx pos -1)))) |
||
( |
(find-all-pos "bc" str)</lang> |
||
=={{header|Nimrod}}== |
=={{header|Nimrod}}== |