API for string - clojure-contrib v1.2 (stable)

clojure-contrib is now deprecated

clojure-contrib is no longer being developed or maintained.

Rather than a single, monolithic, contributions library, Clojure now has a set of separate libraries for each unit of functionality. The libraries are in the Clojure GitHub organization at https://github.com/clojure. API documentation of the libraries can be found at https://clojure.github.io.

If you're looking for a specific function or namespace from the old clojure-contrib, see "Where Did Clojure.Contrib Go".


Full namespace name: clojure.contrib.string

Overview





Public Variables and Functions



as-str

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (as-str)
       (as-str x)
       (as-str x & ys)
Like clojure.core/str, but if an argument is a keyword or symbol,
its name will be used instead of its literal representation.

Example:
   (str :foo :bar)     ;;=> ":foo:bar"
   (as-str :foo :bar)  ;;=> "foobar"

Note that this does not apply to keywords or symbols nested within
data structures; they will be rendered as with str.

Example:
   (str {:foo :bar})     ;;=> "{:foo :bar}"
   (as-str {:foo :bar})  ;;=> "{:foo :bar}" 
Source


blank?

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (blank? s)
True if s is nil, empty, or contains only whitespace.
Deprecated since clojure-contrib version 1.2
Source


butlast

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (butlast n s)
Returns s without the last n characters.  Returns an empty string
if n is greater than the length of s.
Source


capitalize

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (capitalize s)
Converts first character of the string to upper-case, all other
characters to lower-case.
Deprecated since clojure-contrib version 1.2
Source


chomp

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (chomp s)
Removes all trailing newline \n or return \r characters from
string.  Note: String.trim() is similar and faster.
Deprecated in 1.2. Use clojure.string/trim-newline
Deprecated since clojure-contrib version 1.2
Source


chop

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (chop s)
Removes the last character of string, does nothing on a zero-length
string.
Source


codepoints

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (codepoints s)
Returns a sequence of integer Unicode code points in s.  Handles
Unicode supplementary characters (above U+FFFF) correctly.
Source


dochars

macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (dochars bindings & body)
bindings => [name string]

Repeatedly executes body, with name bound to each character in
string.  Does NOT handle Unicode supplementary characters (above
U+FFFF).
Source


docodepoints

macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (docodepoints bindings & body)
bindings => [name string]

Repeatedly executes body, with name bound to the integer code point
of each Unicode character in the string.  Handles Unicode
supplementary characters (above U+FFFF) correctly.
Source


drop

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (drop n s)
Drops first n characters from s.  Returns an empty string if n is
greater than the length of s.
Source


escape

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (escape cmap s)
Returns a new String by applying cmap (a function or a map) to each
character in s.  If cmap returns nil, the original character is
added to the output unchanged.
Deprecated since clojure-contrib version 1.2
Source


get

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (get s i)
Gets the i'th character in string.
Deprecated since clojure-contrib version 1.2
Source


grep

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (grep re coll)
Filters elements of coll by a regular expression.  The String
representation (with str) of each element is tested with re-find.
Source


join

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (join separator coll)
Returns a string of all elements in coll, separated by
separator.  Like Perl's join.
Deprecated since clojure-contrib version 1.2
Source


lower-case

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (lower-case s)
Converts string to all lower-case.
Deprecated since clojure-contrib version 1.2
Source


ltrim

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (ltrim s)
Removes whitespace from the left side of string.
Deprecated in 1.2. Use clojure.string/triml.
Deprecated since clojure-contrib version 1.2
Source


map-str

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (map-str f coll)
Apply f to each element of coll, concatenate all results into a
String.
Source


partition

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (partition re s)
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: (partition #"[a-z]+" "abc123def")
returns: ("" "abc" "123" "def")
Source


repeat

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (repeat n s)
Returns a new String containing s repeated n times.
Source


replace-by

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (replace-by re f s)
Replaces all matches of re in s with the result of
(f (re-groups the-match)).
Deprecated since clojure-contrib version 1.2
Source


replace-char

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (replace-char a b s)
Replaces all instances of character a with character b in s.
Deprecated since clojure-contrib version 1.2
Source


replace-first-by

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (replace-first-by re f s)
Replace first match of re in s with the result of
(f (re-groups the-match)).
Deprecated since clojure-contrib version 1.2
Source


replace-first-re

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (replace-first-re re replacement s)
Replace first match of re in s.
Deprecated since clojure-contrib version 1.2
Source


replace-first-str

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (replace-first-str a b s)
Replace first occurance of substring a with b in s.
Deprecated since clojure-contrib version 1.2
Source


replace-re

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (replace-re re replacement s)
Replaces all matches of re with replacement in s.
Deprecated since clojure-contrib version 1.2
Source


replace-str

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (replace-str a b s)
Replaces all instances of substring a with b in s.
Deprecated since clojure-contrib version 1.2
Source


reverse

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (reverse s)
Returns s with its characters reversed.