diff options
author | Stuart Sierra <mail@stuartsierra.com> | 2009-06-05 21:05:20 +0000 |
---|---|---|
committer | Stuart Sierra <mail@stuartsierra.com> | 2009-06-05 21:05:20 +0000 |
commit | 794e921618f05eb66b19b7e9a7e5ed70a74f0a6b (patch) | |
tree | ba845980daf82cea02f8bf64a10bc0c11a07019d | |
parent | d1e94596041492038f321885bf77e16d9a0a7589 (diff) |
str_utils2.clj: added missing docstrings
-rw-r--r-- | src/clojure/contrib/str_utils2.clj | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/clojure/contrib/str_utils2.clj b/src/clojure/contrib/str_utils2.clj index 40765dfc..bd484a3c 100644 --- a/src/clojure/contrib/str_utils2.clj +++ b/src/clojure/contrib/str_utils2.clj @@ -245,13 +245,19 @@ (defn swap-case [#^String s] (throw (IllegalStateException. "swap-case not implemented yet."))) -(defn ltrim [#^String s] +(defn ltrim + "Removes whitespace from the left side of string." + [#^String s] (replace s #"^\s+" "")) -(defn rtrim [#^String s] +(defn rtrim + "Removes whitespace from the right side of string." + [#^String s] (replace s #"\s+$" "")) -(defn split-lines [#^String s] +(defn split-lines + "Splits s on \\n or \\r\\n." + [#^String s] (seq (.split #"\r?\n" s))) @@ -261,22 +267,34 @@ ;; functions. They are included here for completeness, and for use ;; when mapping over a collection of strings. -(defn upper-case [#^String s] +(defn upper-case + "Converts string to all upper-case." + [#^String s] (.toUpperCase s)) -(defn lower-case [#^String s] +(defn lower-case + "Converts string to all lower-case." + [#^String s] (.toLowerCase s)) (defn split + "Splits string on a regular expression. Optional argument limit is + the maximum number of splits." ([#^String s #^Pattern re] (seq (.split re s))) ([#^String s #^Pattern re limit] (seq (.split re s limit)))) -(defn trim [#^String s] +(defn trim + "Removes whitespace from both ends of string." + [#^String s] (.trim s)) -(defn contains? [#^String s substring] +(defn contains? + "True if s contains the substring." + [#^String s substring] (.contains s substring)) -(defn get [#^String s i] +(defn get + "Gets the i'th character in string." + [#^String s i] (.charAt s i)) |