diff options
author | Ben Smith-Mannschott <bsmith.occs@gmail.com> | 2010-08-28 10:38:36 +0200 |
---|---|---|
committer | Stuart Sierra <mail@stuartsierra.com> | 2010-09-03 12:23:36 -0400 |
commit | 6047457b6b1af0d307287daf49695f7249ecd749 (patch) | |
tree | 69c63cbabecf7b86f4be0aeea9609ed31242c970 | |
parent | 2c6c9e3eca8039964b451be38cdf9d7044dd0b06 (diff) |
remove deprecated clojure.contrib.str-utils
Signed-off-by: Stuart Sierra <mail@stuartsierra.com>
-rw-r--r-- | modules/complete/pom.xml | 5 | ||||
-rw-r--r-- | modules/str-utils/pom.xml | 16 | ||||
-rw-r--r-- | modules/str-utils/src/main/clojure/clojure/contrib/str_utils.clj | 103 | ||||
-rw-r--r-- | pom.xml | 1 |
4 files changed, 0 insertions, 125 deletions
diff --git a/modules/complete/pom.xml b/modules/complete/pom.xml index 9de805ac..bfa81296 100644 --- a/modules/complete/pom.xml +++ b/modules/complete/pom.xml @@ -312,11 +312,6 @@ </dependency> <dependency> <groupId>org.clojure.contrib</groupId> - <artifactId>str-utils</artifactId> - <version>1.3.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.clojure.contrib</groupId> <artifactId>str-utils2</artifactId> <version>1.3.0-SNAPSHOT</version> </dependency> diff --git a/modules/str-utils/pom.xml b/modules/str-utils/pom.xml deleted file mode 100644 index 63ea53e5..00000000 --- a/modules/str-utils/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http//www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 - http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.clojure.contrib</groupId> - <artifactId>parent</artifactId> - <version>1.3.0-SNAPSHOT</version> - <relativePath>../parent</relativePath> - </parent> - <artifactId>str-utils</artifactId> - <dependencies> - </dependencies> -</project>
\ No newline at end of file diff --git a/modules/str-utils/src/main/clojure/clojure/contrib/str_utils.clj b/modules/str-utils/src/main/clojure/clojure/contrib/str_utils.clj deleted file mode 100644 index 2aee325a..00000000 --- a/modules/str-utils/src/main/clojure/clojure/contrib/str_utils.clj +++ /dev/null @@ -1,103 +0,0 @@ -;;; str_utils.clj -- string utilities for Clojure - -;; by Stuart Sierra <mail@stuartsierra.com> -;; April 8, 2008 - -;; Copyright (c) Stuart Sierra, 2008. All rights reserved. The use -;; and distribution terms for this software are covered by the Eclipse -;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) -;; which can be found in the file epl-v10.html 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. - -;; DEPRECATED in 1.2: Promoted to clojure.java.string. Note that -;; many function names and semantics have changed - -(ns - ^{:author "Stuart Sierra", - :deprecated "1.2" - :doc "String utilities for Clojure"} - clojure.contrib.str-utils - (: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-partition - "Splits the string into a lazy sequence of substrings, alternating - between substrings that match the patthern and the substrings - between the matches. The sequence always starts with the substring - before the first match, or an empty string if the beginning of the - string matches. - - For example: (re-partition #\"[a-z]+\" \"abc123def\") - - Returns: (\"\" \"abc\" \"123\" \"def\")" - [^Pattern re string] - (let [m (re-matcher re string)] - ((fn step [prevend] - (lazy-seq - (if (.find m) - (cons (.subSequence string prevend (.start m)) - (cons (re-groups m) - (step (+ (.start m) (count (.group m)))))) - (when (< prevend (.length string)) - (list (.subSequence string prevend (.length string))))))) - 0))) - -(defn re-gsub - "Replaces all instances of 'pattern' in 'string' with - 'replacement'. Like Ruby's 'String#gsub'. - - If (ifn? replacment) is true, the replacement is called with the - match. - " - [^java.util.regex.Pattern regex replacement ^String string] - (if (ifn? replacement) - (let [parts (vec (re-partition regex string))] - (apply str - (reduce (fn [parts match-idx] - (update-in parts [match-idx] replacement)) - parts (range 1 (count parts) 2)))) - (.. regex (matcher string) (replaceAll replacement)))) - -(defn re-sub - "Replaces the first instance of 'pattern' in 'string' with - 'replacement'. Like Ruby's 'String#sub'. - - If (ifn? replacement) is true, the replacement is called with - the match. - " - [^Pattern regex replacement ^String string] - (if (ifn? replacement) - (let [m (re-matcher regex string)] - (if (.find m) - (str (.subSequence string 0 (.start m)) - (replacement (re-groups m)) - (.subSequence string (.end m) (.length 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))) - - -(defn chop - "Removes the last character of string." - [s] - (subs s 0 (dec (count s)))) - -(defn chomp - "Removes all trailing newline \\n or return \\r characters from - string. Note: String.trim() is similar and faster." - [s] - (re-sub #"[\r\n]+$" "" s)) @@ -77,7 +77,6 @@ <module>modules/set</module> <module>modules/singleton</module> <module>modules/sql</module> - <module>modules/str-utils</module> <module>modules/str-utils2</module> <module>modules/stream-utils</module> <module>modules/string</module> |