clojure.string is a standard-library namespace for concise string analysis and decomposition. It complements Clojure’s core functions while building on Java’s immutable String type and regular-expression support. section 1.5 section 19.0
Use it to express common transformations directly and compositionally:
- Require the namespace or selected functions explicitly when they are not available through clojure.core. section 1.4
- Combine split, capitalize, and join to convert structured identifiers such as currentBalance into readable words. section 1.5
- Prefer focused standard-library functions over manually coordinating lower-level operations when they make the algorithm shorter and clearer. section 1.5
Readable camel-case labels
(require '[clojure.string :refer [split capitalize join]]) (defn separate-words [s] (->> (split s #"(?=[A-Z])") (map capitalize) (join " "))) (separate-words "currentBalance") ;; "Current Balance" section 1.5
