API for str-utils2 - clojure-contrib v1.2 (stable)

by Stuart Sierra

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 http://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.str-utils2

Overview

This is a library of string manipulation functions.  It
is intented as a replacement for clojure.contrib.str-utils.

You cannot (use 'clojure.contrib.str-utils2) because it defines
functions with the same names as functions in clojure.core.
Instead, do (require '[clojure.contrib.str-utils2 :as s])
or something similar.

Goals:
  1. Be functional
  2. String argument first, to work with ->
  3. Performance linear in string length

Some ideas are borrowed from
http://github.com/francoisdevlin/devlinsf-clojure-utils/
Deprecated since clojure-contrib version 1.2

Public Variables and Functions



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.
Source


butlast

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

Note the argument order is the opposite of clojure.core/butlast;
this is to keep the string as the first argument for use with ->
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.
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.
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


contains?

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (contains? s substring)
True if s contains the substring.
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 s n)
Drops first n characters from s.  Returns an empty string if n is
greater than the length of s.

Note the argument order is the opposite of clojure.core/drop; this
is to keep the string as the first argument for use with ->
Source


escape

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (escape s cmap)
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.
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.
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.
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.
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.
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


partial

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (partial f & args)
Like clojure.core/partial for functions that take their primary
argument first.

Takes a function f and its arguments, NOT INCLUDING the first
argument.  Returns a new function whose first argument will be the
first argument to f.

Example: (str-utils2/partial str-utils2/take 2)
         ;;=> (fn [s] (str-utils2/take s 2))
Source


partition

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


repeat

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


replace

multimethod
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (replace string pattern replacement)
Replaces all instances of pattern in string with replacement.

Allowed argument types for pattern and replacement are:
 1. String and String
 2. Character and Character
 3. regex Pattern and String
    (Uses java.util.regex.Matcher.replaceAll)
 4. regex Pattern and function
    (Calls function with re-groups of each match, uses return
     value as replacement.)
Source


replace-first

multimethod
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (replace-first s pattern replacement)
Replaces the first instance of pattern in s with replacement.

Allowed argument types for pattern and replacement are:
 1. String and String
 2. regex Pattern and String
    (Uses java.util.regex.Matcher.replaceAll)
 3. regex Pattern and function
Source


reverse

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


rtrim

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (rtrim s)
Removes whitespace from the right side of string.
Source


split

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (split s re)
       (split s re limit)
Splits string on a regular expression.  Optional argument limit is
the maximum number of splits.
Source


split-lines

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (split-lines s)
Splits s on \n or \r\n.
Source


swap-case

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (swap-case s)
Changes upper case characters to lower case and vice-versa.
Handles Unicode supplementary characters correctly.  Uses the
locale-sensitive String.toUpperCase() and String.toLowerCase()
methods.
Source


tail

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (tail s n)
Returns the last n characters of s.
Source


take

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (take s n)
Take first n characters from s, up to the length of s.

Note the argument order is the opposite of clojure.core/take; this
is to keep the string as the first argument for use with ->
Source


trim

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (trim s)
Removes whitespace from both ends of string.
Source


upper-case

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (upper-case s)
Converts string to all upper-case.
Source
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.