diff options
Diffstat (limited to 'src/clojure/contrib/str_utils2.clj')
-rw-r--r-- | src/clojure/contrib/str_utils2.clj | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/clojure/contrib/str_utils2.clj b/src/clojure/contrib/str_utils2.clj index 8529d2c4..1fbd030d 100644 --- a/src/clojure/contrib/str_utils2.clj +++ b/src/clojure/contrib/str_utils2.clj @@ -29,7 +29,8 @@ Some ideas are borrowed from http://github.com/francoisdevlin/devlinsf-clojure-utils/"} clojure.contrib.str-utils2 - (:refer-clojure :exclude (take replace drop butlast partition contains? get)) + (:refer-clojure :exclude (take replace drop butlast partition + contains? get repeat reverse)) (:import (java.util.regex Pattern))) @@ -141,6 +142,16 @@ s (.substring s (- (count s) n)))) +(defn repeat + "Returns a new String containing s repeated n times." + [#^String s n] + (apply str (clojure.core/repeat n s))) + +(defn reverse + "Returns s with its characters reversed." + [#^String s] + (.toString (.reverse (StringBuilder. s)))) + (defmulti #^{:doc "Replaces all instances of pattern in string with replacement. |