Public Variables and Functions
blank?
functionUsage: (blank? s)
True if s is nil, empty, or contains only whitespace.
Added in Clojure version 1.2
Source
capitalize
functionUsage: (capitalize s)
Converts first character of the string to upper-case, all othercharacters to lower-case.
Added in Clojure version 1.2
Source
ends-with?
functionUsage: (ends-with? s substr)
True if s ends with substr.
Added in Clojure version 1.8
Source
escape
functionUsage: (escape s cmap)
Return a new string, using cmap to escape each character chfrom s as follows:If (cmap ch) is nil, append ch to the new string.If (cmap ch) is non-nil, append (str (cmap ch)) instead.
Added in Clojure version 1.2
Source
includes?
functionUsage: (includes? s substr)
True if s includes substr.
Added in Clojure version 1.8
Source
index-of
functionUsage: (index-of s value) (index-of s value from-index)
Return index of value (string or char) in s, optionally searchingforward from from-index. Return nil if value not found.
Added in Clojure version 1.8
Source
join
functionUsage: (join coll) (join separator coll)
Returns a string of all elements in coll, as returned by (seq coll),separated by an optional separator.
Added in Clojure version 1.2
Source
last-index-of
functionUsage: (last-index-of s value) (last-index-of s value from-index)
Return last index of value (string or char) in s, optionallysearching backward from from-index. Return nil if value not found.
Added in Clojure version 1.8
Source
lower-case
functionUsage: (lower-case s)
Converts string to all lower-case.
Added in Clojure version 1.2
Source
re-quote-replacement
functionUsage: (re-quote-replacement replacement)
Given a replacement string that you wish to be a literalreplacement for a pattern match in replace or replace-first, do thenecessary escaping of special characters in the replacement.
Added in Clojure version 1.5
Source
replace
functionUsage: (replace s match replacement)
Replaces all instance of match with replacement in s.match/replacement can be:string / stringchar / charpattern / (string or function of match).See also replace-first.The replacement is literal (i.e. none of its characters are treatedspecially) for all cases above except pattern / string.For pattern / string, $1, $2, etc. in the replacement string aresubstituted with the string that matched the correspondingparenthesized group in the pattern. If you wish your replacementstring r to be used literally, use (re-quote-replacement r) as thereplacement argument. See also documentation forjava.util.regex.Matcher's appendReplacement method.Example:(clojure.string/replace "Almost Pig Latin" #"\b(\w)(\w+)\b" "$2$1ay")-> "lmostAay igPay atinLay"
Added in Clojure version 1.2
Source
replace-first
functionUsage: (replace-first s match replacement)
Replaces the first instance of match with replacement in s.match/replacement can be:char / charstring / stringpattern / (string or function of match).See also replace.The replacement is literal (i.e. none of its characters are treatedspecially) for all cases above except pattern / string.For pattern / string, $1, $2, etc. in the replacement string aresubstituted with the string that matched the correspondingparenthesized group in the pattern. If you wish your replacementstring r to be used literally, use (re-quote-replacement r) as thereplacement argument. See also documentation forjava.util.regex.Matcher's appendReplacement method.Example:(clojure.string/replace-first "swap first two words" #"(\w+)(\s+)(\w+)" "$3$2$1")-> "first swap two words"
Added in Clojure version 1.2
Source
reverse
functionUsage: (reverse s)
Returns s with its characters reversed.
Added in Clojure version 1.2
Source
split
functionUsage: (split s re) (split s re limit)
Splits string on a regular expression. Optional argument limit isthe maximum number of parts. Not lazy. Returns vector of the parts.Trailing empty strings are not returned - pass limit of -1 to return all.
Added in Clojure version 1.2
Source
split-lines
functionUsage: (split-lines s)
Splits s on \n or \r\n. Trailing empty lines are not returned.
Added in Clojure version 1.2
Source
starts-with?
functionUsage: (starts-with? s substr)
True if s starts with substr.
Added in Clojure version 1.8
Source
trim
functionUsage: (trim s)
Removes whitespace from both ends of string.
Added in Clojure version 1.2
Source
trim-newline
functionUsage: (trim-newline s)
Removes all trailing newline \n or return \r characters fromstring. Similar to Perl's chomp.
Added in Clojure version 1.2
Source
triml
functionUsage: (triml s)
Removes whitespace from the left side of string.
Added in Clojure version 1.2
Source
trimr
functionUsage: (trimr s)
Removes whitespace from the right side of string.
Added in Clojure version 1.2
Source
upper-case
functionUsage: (upper-case s)
Converts string to all upper-case.
Added in Clojure version 1.2
Source