• (replace-by re f s)
Replaces all matches of re in s with the result of
(f (re-groups the-match)).

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/string.clj:169 top

(defn replace-by
  "Replaces all matches of re in s with the result of 
  (f (re-groups the-match))."
  {:deprecated "1.2"}
  [re f ^String s]
  (let [m (re-matcher re s)]
    (let [buffer (StringBuffer. (.length s))]
      (loop []
        (if (.find m)
          (do (.appendReplacement m buffer (f (re-groups m)))
              (recur))
          (do (.appendTail m buffer)
              (.toString buffer)))))))
Vars in clojure.contrib.string/replace-by: defn let loop re-groups
Used in 0 other vars

Comments top

No comments for replace-by. Log in to add a comment.