Converts a CamelCase string to underscores: "AliceInWonderLand" becomes:
"alice_in_wonderland"

@param camel camel case input
@return result converted to underscores.
329556
public static String underscore(String camel) {

        StringBuilder bob = new StringBuilder(camel); // standard adds 16 extra slots for underscores
        
        // lowercase the first letter
        if (camel.charAt(0) >= 'A' && camel.charAt(0) <= 'Z')
            bob.setCharAt(0, Character.toLowerCase(camel.charAt(0)));
        
        int extra = 0;
        // i = 1, because we already lowered it
        for (int i = 1; i < camel.length(); i++) {
            char b = camel.charAt(i);
            if (b >= 'A' && b <= 'Z') { // within range
                // lower it
                bob.setCharAt(i + extra, Character.toLowerCase(b));
                // add underscore
                bob.insert(i + extra++, '_');
            }
        }

        return bob.toString();
    }
753356
def _snake_to_camel_case(value):
    """"""
    words = value.split("_")
    return words[0] + "".join(map(str.capitalize, words[1:]))
1372359
def snake_to_camel(name):
    
    ret = "".join(x.title() for x in name.split("_"))
    ret = ret[0].lower() + ret[1:]
    return ret
65702
def camel_case(string):
    
    if not string:
        return string
    parts = snake_case(string).split('_')
    rv = ''
    while parts:
        part = parts.pop(0)
        rv += part or '_'
        if part:
            break
    return rv + ''.join(x.title() for x in parts)
158478
public static String camelToSnake(String camel, boolean upper) {
        StringBuilder stringBuilder = new StringBuilder();
        for (char c : camel.toCharArray()) {
            char nc = upper ? Character.toUpperCase(c) : Character.toLowerCase(c);
            if (Character.isUpperCase(c)) {
                stringBuilder.append('_').append(nc);
            } else {
                stringBuilder.append(nc);
            }
        }
        return stringBuilder.toString();
    }
606726
def camelcase_underscore(name):
    
    s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
    return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
1113533
def lower_camel_case_from_underscores(string):
    """"""
    components = string.split('_')
    string = components[0]
    for component in components[1:]:
        string += component[0].upper() + component[1:]
    return string
668640
def kebab_case(string):
    
    if not string:
        return string
    string = string.replace('_', '-').replace(' ', '-')
    return de_camel(string, '-')
398118
public static function camelCaseFromUnderscore($strName)
    {
        $strToReturn = '';

        // If entire underscore string is all uppercase, force to all lowercase
        // (mixed case and all lowercase can remain as is)
        if ($strName == strtoupper($strName)) {
            $strName = strtolower($strName);
        }

        while (($intPosition = strpos($strName, "_")) !== false) {
            // Use 'ucfirst' to create camelcasing
            $strName = ucfirst($strName);
            if ($intPosition == 0) {
                $strName = substr($strName, 1);
            } else {
                $strToReturn .= substr($strName, 0, $intPosition);
                $strName = substr($strName, $intPosition + 1);
            }
        }

        $strToReturn .= ucfirst($strName);
        return $strToReturn;
    }
720585
public static String snakeCaseToCamelCase(String snakeCase) {
		if(snakeCase.contains("-")) {
			StringBuilder camelCaseStr = new StringBuilder(snakeCase.length());
			boolean toUpperCase = false;
			for (char c : snakeCase.toCharArray()) {
				if (c == '-')
					toUpperCase = true;
				else {
					if (toUpperCase) {
						toUpperCase = false;
						c = Character.toUpperCase(c);
					}
					camelCaseStr.append(c);
				}
			}
			snakeCase = camelCaseStr.toString();
		}
		return snakeCase;
	}
949661
def camel_case_from_underscores(string):
    """"""
    components = string.split('_')
    string = ''
    for component in components:
        string += component[0].upper() + component[1:]
    return string
1157052
def camel_to_(s):
    
    s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', s)
    return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
224813
public static String camelCaseToHyphenCase(String s) {

        StringBuilder parsedString = new StringBuilder(s.substring(0, 1).toLowerCase());

        for (char c : s.substring(1).toCharArray()) {

            if (Character.isUpperCase(c)) {
                parsedString.append("-").append(Character.toLowerCase(c));
            } else {
                parsedString.append(c);
            }
        }

        return parsedString.toString();
    }
744757
def to_camel_case(snake_case_string):
    
    parts = snake_case_string.lstrip('_').split('_')
    return parts[0] + ''.join([i.title() for i in parts[1:]])
1008002
public static String underscoreToCamelCase(final String undescoredString) {

        // Split the string for each underscore
        final String[] parts = undescoredString.split(CASE_SEPARATOR);
        final StringBuilder camelCaseString = new StringBuilder(undescoredString.length());
        camelCaseString.append(parts[0].toLowerCase(Locale.getDefault()));

        // Skip the first part already added
        for (int i = 1; i < parts.length; i++) {
            // First letter to upper case
            camelCaseString.append(parts[i].substring(0, 1).toUpperCase(Locale.getDefault()));
            // Others to lower case
            camelCaseString.append(parts[i].substring(1).toLowerCase(Locale.getDefault()));
        }
        return camelCaseString.toString();

    }
542192
function ( obj, camel ) {
		var result = string.trim( obj ).replace( /\s+/g, "-" );

		if ( camel === true ) {
			result = result.replace( /([A-Z])/g, "-$1" ).toLowerCase();
		}

		return result;
	}
567568
def camel_to_snake(self, s):
        
        return self._underscore_re2.sub(r'\1_\2', self._underscore_re1.sub(r'\1_\2', s)).lower()