To do this, you can use the basic functions of the string class.
user=> (.replaceAll "hello world" "[aeiou]" "") "hll wrld"
If this sounds like a trick, you can turn the string into seq and then filter it with the complement of the set and then put it back into the string.
user=> (apply str (filter (complement #{\a \e \i \o \u}) (seq "hello world"))) "hll wrld"
Kits in clojure are also features. complement takes a function and returns a function that returns a boolean function not from the original function. This is equivalent to this. apply takes a function and a bunch of arguments and calls that work with these arguments (roughly).
user=> (apply str (filter #(not (#{\a \e \i \o \u} %)) (seq "hello world"))) "hll wrld"
change
One more...
user=> (apply str (re-seq #"[^aeiou]" "hello world")) "hll wrld"
#"[^aeiou]" is a regular expression, and re-seq turns matches into seq. It is clojure-like and seems to work well. I can try this before moving on to Java. Those that seq lines are quite a bit slower.
Important change
There is another way, and you need to use clojure.string/replace . This might be the best way, given that it should work in either clojure or Clojurescript.
eg.
dev:cljs.user=> (require '[clojure.string :as str]) nil dev:cljs.user=> (str/replace "hello world" #"[aeiou]" "") "hll wrld"
source share