• (replace string pattern replacement)
Replaces all instances of pattern in string with replacement.

Allowed argument types for pattern and replacement are:
1. String and String
2. Character and Character
3. regex Pattern and String
(Uses java.util.regex.Matcher.replaceAll)
4. regex Pattern and function
(Calls function with re-groups of each match, uses return
value as replacement.)

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/str_utils2.clj:159 top

(defmulti
  ^{:doc "Replaces all instances of pattern in string with replacement.  
  
  Allowed argument types for pattern and replacement are:
   1. String and String
   2. Character and Character
   3. regex Pattern and String
      (Uses java.util.regex.Matcher.replaceAll)
   4. regex Pattern and function
      (Calls function with re-groups of each match, uses return 
       value as replacement.)"
     :arglists '([string pattern replacement])
     :tag String}
  replace
  (fn [^String string pattern replacement]
    [(class pattern) (class replacement)]))
Vars in clojure.contrib.str-utils2/replace: defmulti fn replace
Used in 0 other vars

Comments top

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