liveBook · Manning

Clojure.string

As explained in Clojure: The Essential Reference

clojure.string is the Clojure standard-library namespace providing additional string-processing functions.

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

How Clojure: The Essential Reference covers it

How deep it goes
Demonstrates namespace selection and composed transformations, but does not document the namespace’s complete API or edge cases.
Examples
Uses split, capitalize, and join to turn camel-case keys into readable words.
What it assumes
Assumes basic Clojure namespace and sequence-function knowledge while grounding string support in Java strings.
What you can do after
Apply it via require and composed functions to simplify string-decomposition workflows.
How it connects
Connects string processing with regular expressions, namespaces, sequence functions, and readable data formatting.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Clojure: The Essential Reference. The section links point to the parts of the book it draws on.