I would like to write a function replace-several
that receives a string and a set of replacements and apply all the replacements (where the replacements see the result of the previous replacements).
I thought about the following interface:
(replace-several "abc" #"a" "c"
#"b" "l"
#"c" "j"); should return "jlj"
Two questions:
Remark: To make a single replacement, there is replace
available in clojure.string.
(str/escape "abc" {\a "c" \b "l" \c "j"})
; => "clj"
Docs escape
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With