Namespace: joker.string
v1.0Contents
Summary
Implements simple functions to manipulate strings.
Index
- blank?
- capitalize
- ends-with?
- escape
- includes?
- index-of
- join
- last-index-of
- lower-case
- pad-left
- pad-right
- re-quote
- replace
- replace-first
- reverse
- split
- split-lines
- starts-with?
- trim
- trim-left
- trim-newline
- trim-right
- triml
- trimr
- upper-case
Legend
-
Constant
Variable
Function
Macro
Special form
Type
GoVar
Receiver/Method
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
(None.)
Variables
-
(None.)
Functions, Macros, and Special Forms
-
blank?
Function v1.0(blank? s)
True if s is nil, empty, or contains only whitespace.
-
capitalize
Function v1.0(capitalize s)
Converts first character of the string to upper-case, all other
characters to lower-case. -
ends-with?
Function v1.0(ends-with? s substr)
True if s ends with substr.
-
escape
Function v1.0(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. -
includes?
Function v1.0(includes? s substr)
True if s includes substr.
-
index-of
Function v1.0(index-of s value)
(index-of s value from)
Return index of value (string or char) in s, optionally searching
forward from from or nil if not found. -
join
Function v1.0(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
Function v1.0(last-index-of s value)
(last-index-of s value from)
Return last index of value (string or char) in s, optionally
searching backward from from or nil if not found. -
lower-case
Function v1.0(lower-case s)
Converts string to all lower-case.
-
pad-left
Function v1.0(pad-left s pad n)
Returns s padded with pad at the beginning to length n.
-
pad-right
Function v1.0(pad-right s pad n)
Returns s padded with pad at the end to length n.
-
re-quote
Function v1.0(re-quote s)
Returns an instance of Regex that matches the string exactly
-
replace
Function v1.0(replace s match repl)
Replaces all instances of match (String or Regex) with string repl in string s.
If match is Regex, $1, $2, etc. in the replacement string repl are
substituted with the string that matched the corresponding
parenthesized group in the pattern.
-
replace-first
Function v1.0(replace-first s match repl)
Replaces the first instance of match (String or Regex) with string repl in string s.
If match is Regex, $1, $2, etc. in the replacement string repl are
substituted with the string that matched the corresponding
parenthesized group in the pattern.
-
reverse
Function v1.0(reverse s)
Returns s with its characters reversed.
-
split
Function v1.0(split s sep)
(split s sep n)
Splits string on a string or regular expression. Returns vector of the splits.
No more than n elements will be returned in the vector; the last element will
be the unsplit remainder. If n is <= 0, no limit is in effect (all substrings
are returned in the vector). -
split-lines
Function v1.0(split-lines s)
Splits string on \n or \r\n. Returns vector of the splits.
-
starts-with?
Function v1.0(starts-with? s substr)
True if s starts with substr.
-
trim
Function v1.0(trim s)
Removes whitespace from both ends of string.
-
trim-left
Function v1.0(trim-left s)
Removes whitespace from the left side of string.
-
trim-newline
Function v1.0(trim-newline s)
Removes all trailing newline \n or return \r characters from string.
-
trim-right
Function v1.0(trim-right s)
Removes whitespace from the right side of string.
-
triml
Function v1.0(triml s)
Removes whitespace from the left side of string.
-
trimr
Function v1.0(trimr s)
Removes whitespace from the right side of string.
-
upper-case
Function v1.0(upper-case s)
Converts string to all upper-case.
Types
-
(None.)