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

by Stuart Sierra

Usage:
(ns your-namespace
  (:require clojure.contrib.str-utils))

Overview

String utilities for Clojure
Deprecated since clojure-contrib version 1.2

Public Variables and Functions



chomp

function
Usage: (chomp s)
Removes all trailing newline \n or return \r characters from
string.  Note: String.trim() is similar and faster.
Source


chop

function
Usage: (chop s)
Removes the last character of string.
Source


re-gsub

function
Usage: (re-gsub regex replacement string)
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.
Source


re-partition

function
Usage: (re-partition re string)
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")
Source


re-split

function
Usage: (re-split pattern string)
       (re-split pattern string limit)
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'.
Source


re-sub

function
Usage: (re-sub regex replacement string)
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.
Source


str-join

function
Usage: (str-join separator sequence)
Returns a string of all elements in 'sequence', separated by
'separator'.  Like Perl's 'join'.
Source
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.