Trying to write a substring function in Clojure. I am sure there is a more idiomatic way. Can anyone enlighten me?
Otherwise, here is my version. Thoughts?
(defn substring?
"is 'sub' in 'str'?"
[sub str]
(if (not= (.indexOf str sub) -1)
true
false))
re-find
might be the simplest way. The oldcontrib.string
used.contains
as well so it was probably the best tool for the job. – georgek Nov 1 '13 at 0:24