Hi,
I have two questions about clojure.string/replace-first.

1.
Is this expected behavior of replace-first?

(require '[clojure.string :as str])
(str/replace-first "abc def" #"ghi" (fn [a] (str a a)))
=> nil

I don't think so, because string / string argument version returns
original string when mismatched.
(str/replace-first "abc def" "ghi" "jkl")
=> "abc def"

2.
Is it difficult that replace-first support argument of string /
function besides regex / function (i.e. without using Pattern/quote)?

(str/replace-first "abc def" "def" (fn [a] (str a a)))
=> "abc defdef"

The reason why I'd like to avoid using Pattern/quote is that ,I think,
to replace string with string should be more lightweight than with
regex.

Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to