Case handling transducers for strings.
Case handling transducers for strings.
(capitalize)
(capitalize s)
Capitalize only the first letter of s
or return a transducer to do this.
All other characters will be lower case. Unlike the Clojure and Python capitalization functions, leading non-letter characters, such as spaces, are skipped. Title case is used, rather than upper case.
(capitalize " the United Kingdom (UK) or Britain, is a country ")
;; => " The united kingdom (uk) or britain, is a country "
Capitalize only the first letter of `s` or return a transducer to do this. All other characters will be lower case. Unlike the Clojure and Python capitalization functions, leading non-letter characters, such as spaces, are skipped. Title case is used, rather than upper case. ```clojure (capitalize " the United Kingdom (UK) or Britain, is a country ") ;; => " The united kingdom (uk) or britain, is a country " ```
(capitalize-first)
(capitalize-first s)
Capitalize only the first letter of s
or return a transducer to do this.
All other characters will be left as-is. Leading non-letter characters, such as spaces, are skipped. Title case is used, rather than upper case.
(capitalize-first " the United Kingdom (UK) or Britain, is a country ")
;; => " The United Kingdom (UK) or Britain, is a country "
Capitalize only the first letter of `s` or return a transducer to do this. All other characters will be left as-is. Leading non-letter characters, such as spaces, are skipped. Title case is used, rather than upper case. ```clojure (capitalize-first " the United Kingdom (UK) or Britain, is a country ") ;; => " The United Kingdom (UK) or Britain, is a country " ```
(capitalize-words)
(capitalize-words s)
Capitalizes space-separated words or returns a transducer for this.
Matches Python's default string.capcase()
function except that whitespace
is not compressed automatically.
(capitalize-words " 1aa bb2cc ")
;; => " 1aa Bb2cc "
Capitalizes space-separated words or returns a transducer for this. Matches Python's default `string.capcase()` function except that whitespace is not compressed automatically. ```clojure (capitalize-words " 1aa bb2cc ") ;; => " 1aa Bb2cc " ```
(compress-whitespace)
(compress-whitespace s)
Squeezes whitespace to one character or returns a transducer for this.
The first whitespace character matched each time is kept. Matches are made
according to Character/isWhitespace
.
(compress-whitespace " a
b
c
")
;; => " a b c
"
Squeezes whitespace to one character or returns a transducer for this. The first whitespace character matched each time is kept. Matches are made according to `Character/isWhitespace`. ```clojure (compress-whitespace " a b c ") ;; => " a b c " ```
(lower-case)
(lower-case s)
Convert every character to lower case, or return a lower-case transducer.
Convert every character to lower case, or return a lower-case transducer.
(string-build rf s)
String builder reduction of the application of rf
to string s
.
String builder reduction of the application of `rf` to string `s`.
(title)
(title s)
Converts a string to title case or returns a stateful transducer to do this.
Uses (but possibly doesn't fully match) the broad Python definition that the
beginning of a word is considered to be any letter that isn't preceded by
another letter. The first letter is converted using Character/toTitleCase
.
(title "they're bill's friends from the UK")
;; => "They'Re Bill'S Friends From The Uk"
Converts a string to title case or returns a stateful transducer to do this. Uses (but possibly doesn't fully match) the broad Python definition that the beginning of a word is considered to be any letter that isn't preceded by another letter. The first letter is converted using `Character/toTitleCase`. ```clojure (title "they're bill's friends from the UK") ;; => "They'Re Bill'S Friends From The Uk" ```
(title-case)
(title-case s)
Convert every character to title case, or return a title-case transducer.
Convert every character to title case, or return a title-case transducer.
(trim)
(trim s)
Trim whitespace around a string or returns a transducer to do this.
(trim "
A
")
;; => "A"
Trim whitespace around a string or returns a transducer to do this. ```clojure (trim " A ") ;; => "A" ```
(trim-newline)
(trim-newline s)
Trim newlines at the end of a string or return a transducer for this.
Newline characters are either or
.
(trim-newline "
a b c
")
;; => "
a b c"
Trim newlines at the end of a string or return a transducer for this. Newline characters are either ` ` or ` `. ```clojure (trim-newline " a b c ") ;; => " a b c" ```
(triml)
(triml s)
Trims whitespace from from the left of a string or a transducer for this.
(triml "
A
")
;; => "A
"
Trims whitespace from from the left of a string or a transducer for this. ```clojure (triml " A ") ;; => "A " ```
(trimr)
(trimr s)
Trims whitespace from from the right of a string or a transducer for this.
(trimr "
A
")
;; => "
A"
Trims whitespace from from the right of a string or a transducer for this. ```clojure (trimr " A ") ;; => " A" ```
(upper-case)
(upper-case s)
Convert every character to upper case, or return an upper-case transducer.
Convert every character to upper case, or return an upper-case transducer.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close