• (replace-first s pattern replacement)
Replaces the first instance of pattern in s with replacement.

Allowed argument types for pattern and replacement are:
1. String and String
2. regex Pattern and String
(Uses java.util.regex.Matcher.replaceAll)
3. regex Pattern and function

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:195 top

(defmulti
  ^{:doc "Replaces the first instance of pattern in s with replacement.

  Allowed argument types for pattern and replacement are:
   1. String and String
   2. regex Pattern and String
      (Uses java.util.regex.Matcher.replaceAll)
   3. regex Pattern and function
"
     :arglists '([s pattern replacement])
     :tag String}
  replace-first
  (fn [s pattern replacement]
    [(class pattern) (class replacement)]))
Vars in clojure.contrib.str-utils2/replace-first: defmulti fn
Used in 0 other vars

Comments top

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