(capitalize s)Converts first character of the string to upper-case, all other characters to lower-case.
(escape s cmap)Return a new string, using cmap to escape each character ch from 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.
(index-of s value)(index-of s value from-index)Return index of value (string or char) in s, optionally searching forward from from-index or nil if not found.
(join coll)(join separator coll)Returns a string of all elements in coll, as returned by (seq coll), separated by an optional separator.
(last-index-of s value)(last-index-of s value from-index)Return last index of value (string or char) in s, optionally searching backward from from-index or nil if not found.
(replace s match replacement)Replaces all instance of match with replacement in s. match/replacement can be: string / string pattern / (string or function of match). See also replace-first. The replacement is literal (i.e. none of its characters are treated specially) for all cases above except pattern / string. For pattern / string, $1, $2, etc. in the replacement string are substituted with the string that matched the corresponding parenthesized group in the pattern. Example: (clojure.string/replace "Almost Pig Latin" #"\b(\w)(\w+)\b" "$2$1ay") -> "lmostAay igPay atinLay"
(replace-first s match replacement)Replaces the first instance of match with replacement in s.
match/replacement can be:
string / string
pattern / (string or function of match).
See also replace.
The replacement is literal (i.e. none of its characters are treated
specially) for all cases above except pattern / string.
For pattern / string, $1, $2, etc. in the replacement string are
substituted with the string that matched the corresponding
parenthesized group in the pattern.
Example:
(clojure.string/replace-first "swap first two words"
#"(\w+)(\s+)(\w+)" "$3$2$1")
-> "first swap two words"(split s re)(split s re limit)Splits string on a regular expression. Optional argument limit is the maximum number of parts. Not lazy. Returns vector of the parts. Trailing empty strings are not returned - pass limit of -1 to return all.
(split-lines s)Splits s on \n or \r\n. Trailing empty lines are not returned.
(trim-newline s)Removes all trailing newline \n or return \r characters from string. Similar to Perl's chomp.