Skip to content

Instantly share code, notes, and snippets.

@uggds
Created September 6, 2015 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uggds/2369c466937f6105b8f6 to your computer and use it in GitHub Desktop.
Save uggds/2369c466937f6105b8f6 to your computer and use it in GitHub Desktop.
(defn ellipsize [words]
(let [[w1 w2 w3] (str/split words #"\s+")]
(str/join " " [w1 w2 w3 "..."])))
(ellipsize "The quick brown fox jumps over the lazy dog.")
-> "The quick brown ..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment