diff options
author | scgilardi <scgilardi@gmail.com> | 2008-08-16 22:48:23 +0000 |
---|---|---|
committer | scgilardi <scgilardi@gmail.com> | 2008-08-16 22:48:23 +0000 |
commit | 3dcb49711054c8f63313a6296cc23404d9e27294 (patch) | |
tree | e47ed2f55bceda2cb638f857aaa5188809e7aac4 /str_utils/str_utils.clj | |
parent | 1341206e051b4ad9473e8a2a3968f58510c628d7 (diff) |
move namespace-directory-aware libs into src/clojure/contrib
Diffstat (limited to 'str_utils/str_utils.clj')
-rw-r--r-- | str_utils/str_utils.clj | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/str_utils/str_utils.clj b/str_utils/str_utils.clj deleted file mode 100644 index cb344024..00000000 --- a/str_utils/str_utils.clj +++ /dev/null @@ -1,44 +0,0 @@ -;;; str_utils.clj -- string utilities for Clojure - -;; by Stuart Sierra <mail@stuartsierra.com> -;; April 8, 2008 - -;; Copyright (c) 2008 Stuart Sierra. All rights reserved. The use and -;; distribution terms for this software are covered by the Common -;; Public License 1.0 (http://www.opensource.org/licenses/cpl1.0.php) -;; which can be found in the file CPL.TXT at the root of this -;; distribution. By using this software in any fashion, you are -;; agreeing to be bound by the terms of this license. You must not -;; remove this notice, or any other, from this software. - - -(clojure/in-ns 'clojure.contrib.str-utils) -(clojure/refer 'clojure) - -(import '(java.util.regex Pattern)) - - -(defn re-split - "Splits the string on instances of 'pattern'. Returns a sequence of - strings. Optional 'limit' argument is the maximum number of - splits. Like Perl's 'split'." - ([#^Pattern pattern string] (seq (. pattern (split string)))) - ([#^Pattern pattern string limit] (seq (. pattern (split string limit))))) - -(defn re-gsub - "Replaces all instances of 'pattern' in 'string' with - 'replacement'. Like Ruby's 'String#gsub'." - [#^Pattern regex replacement #^String string] - (.. regex (matcher string) (replaceAll replacement))) - -(defn re-sub - "Replaces the first instance of 'pattern' in 'string' with - 'replacement'. Like Ruby's 'String#sub'." - [#^Pattern regex replacement #^String string] - (.. regex (matcher string) (replaceFirst replacement))) - -(defn str-join - "Returns a string of all elements in 'sequence', separated by - 'separator'. Like Perl's 'join'." - [separator sequence] - (apply str (interpose separator sequence))) |