Last active
December 13, 2015 17:09
-
-
Save ponkore/4945465 to your computer and use it in GitHub Desktop.
CamelCase を dash-connected な string に変換する(日本語の取扱が今一つとか他にもバグあり)
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 camel-to-dash | |
"convert `CamelCase` string to dash-connected string." | |
[s] | |
(->> (re-seq #"[A-Z]+[^A-Z]+|[a-z]+[^a-z]+" s) | |
(map str/lower-case) | |
(interpose "-") | |
str/join)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment