Takes a camelCased string and converts to snake_case.
492655
def camel_to_snake_case(name):
    """"""
    pattern = r'[A-Z][a-z]+|[A-Z]+(?![a-z])'
    return '_'.join(map(str.lower, re.findall(pattern, name)))
1372359
def snake_to_camel(name):
    
    ret = "".join(x.title() for x in name.split("_"))
    ret = ret[0].lower() + ret[1:]
    return ret
715535
def snake_to_camel(value):
    
    camel = "".join(word.title() for word in value.split("_"))
    return value[:1].lower() + camel[1:]
298352
def _screaming_snake_case(cls, text):
        
        if text.isupper():
            return text
        result = ''
        for pos, symbol in enumerate(text):
            if symbol.isupper() and pos > 0:
                result += '_' + symbol
            else:
                result += symbol.upper()
        return result
350722
def camel_case(snake_str):
    

    components = snake_str.split('_')
    # We capitalize the first letter of each component except the first one
    # with the 'title' method and join them together.
    return components[0] + "".join(x.title() for x in components[1:])
1169183
def camelcase(string):
    '''
    '''
    out = slug(string).replace('-', ' ').title().replace(' ', '')
    return out[0].lower() + out[1:]
1352042
function camelize(string) {
  return string.replace(/-+(.)?/g, function(match, character) {
    return character ? character.toUpperCase() : '';
  });
}
210127
public static String camelCaseToSnakeCase(String camelCase) {
		if (null == camelCase || camelCase.length()==0)
			return camelCase;
		StringBuilder snakeCase = new StringBuilder(camelCase.length()+3);
		snakeCase.append(camelCase.charAt(0));
		boolean hasCamelCase=false;
		for (int i = 1; i < camelCase.length(); i++) {
			char c = camelCase.charAt(i);
			if (Character.isUpperCase(c)) {
				snakeCase.append("-");
				c = Character.toLowerCase(c);
				hasCamelCase=true;
			}
			snakeCase.append(c);
		}
		if (!hasCamelCase)
			return camelCase;

		return snakeCase.toString();
	}
1212268
def camel_to_snake(camel_str):
    '''
    
    '''
    # Attribution: https://stackoverflow.com/a/1176023/633213
    s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', camel_str)
    return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
668640
def kebab_case(string):
    
    if not string:
        return string
    string = string.replace('_', '-').replace(' ', '-')
    return de_camel(string, '-')
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();
    }
996885
def snake_case(a_string):
    

    partial = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', a_string)
    return re.sub('([a-z0-9])([A-Z])', r'\1_\2', partial).lower()
1069536
def camelize(string, lowercase = false)
      result = string
        .to_s
        .split("_")
        .map { |e| e.capitalize }
        .join

      if lowercase
        result[0, 1].downcase + result[1..-1]
      else
        result
      end
    end
93184
def camel_to_snake(camel):
    """"""
    ret = []
    last_lower = False
    for char in camel:
        current_upper = char.upper() == char
        if current_upper and last_lower:
            ret.append("_")
            ret.append(char.lower())
        else:
            ret.append(char.lower())
        last_lower = not current_upper
    return "".join(ret)
1120497
function camelCase(str) {
  if (str.indexOf('_') > -1) {
    str = str.replace(/_(\w)/g, (a, b) => {
      return b.toUpperCase();
    });
  }
  return str;
}
316833
def decamel_to_snake(string):
    
    strings = [decamel(word) if not word.isupper() else word.lower()
               for word in string.split()]
    return "_".join([snake(dstring)for dstring in strings])
414467
function camelCase(str) {
  if (str.indexOf('-') > -1) {
    str = str.replace(/-\w/g, function (letter) {
      return letter.substr(1).toUpperCase();
    });
  }

  return str;
}