Created
December 26, 2014 13:06
-
-
Save maio/e5f85d69c3f6ca281ccd to your computer and use it in GitHub Desktop.
Remove accent from string using Clojure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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