Check if String contains substring in clojure

The easiest way is to use the contains method from java.lang.String:

(.contains "The Band Named Isis" "Isis")

=> true

You can also do it with regular expressions, e.g.

(re-find #"Isis" "The Band Named Isis")

=> “Isis”

(re-find #"Osiris" "The Band Named Isis")

=> nil

If you need your result to be true or false, you can wrap it in boolean:

(boolean (re-find #"Osiris" "The Band Named Isis"))

=> false

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)