Created
August 3, 2012 13:17
-
-
Save digitalex/3247652 to your computer and use it in GitHub Desktop.
CamelTosnake_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
public static String camelToSnakeCase(String camelCased) { | |
def snakeCased = new StringBuilder() | |
for (char c : camelCased) { | |
if (c.isUpperCase()) { | |
snakeCased.append('_') | |
} | |
snakeCased.append(c.toLowerCase()) | |
} | |
snakeCased.toString() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment