Last active
December 20, 2017 22:30
-
-
Save sarogers/de7bafeaf343d8bae1f9845d6e9df40a to your computer and use it in GitHub Desktop.
Capital case to snake case.
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
function capital2snake { | |
echo $(echo $1 | sed -r 's/([A-Z])/_\L\1/g' | sed '1s/^.//') | |
} | |
capital2snake FooBarBaz # => foo_bar_baz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment