Jump to content

String matching: Difference between revisions

→‎TXR Lisp: Use starts-with, ends-with and iflet.
No edit summary
(→‎TXR Lisp: Use starts-with, ends-with and iflet.)
Line 2,965:
((str= big small)
(put-line `@big and @small are equal`))
((matchstarts-str bigwith small big)
(put-line `@small is a prefix of @big`))
((matchends-str bigwith small -1big)
(put-line `@small is a suffix of @big`))
(t (letiflet ((pos (search-str big small)))
(ifput-line `@small occurs in @big at position @pos`)
(put-line `@small occursdoes not occur in @big at position @pos`)))))
(put-line `@small does not occur in @big`))))))
(otherwise
(put-line `usage: @(ldiff *full-args* *args*) <bigstring> <smallstring>`)))</lang>
543

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.