Skip to content

Instantly share code, notes, and snippets.

@maio
Created December 26, 2014 13:06
Show Gist options
  • Save maio/e5f85d69c3f6ca281ccd to your computer and use it in GitHub Desktop.
Save maio/e5f85d69c3f6ca281ccd to your computer and use it in GitHub Desktop.
Remove accent from string using Clojure
(defn deaccent [str]
"Remove accent from string"
;; http://www.matt-reid.co.uk/blog_post.php?id=69
(let [normalized (java.text.Normalizer/normalize str java.text.Normalizer$Form/NFD)]
(clojure.string/replace normalized #"\p{InCombiningDiacriticalMarks}+" "")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment