convert CamelCase style to under_score_case
769428
def camel_to_underscore(name):
    
    as_list = []
    length = len(name)
    for index, i in enumerate(name):
        if index != 0 and index != length - 1 and i.isupper():
            as_list.append('_%s' % i.lower())
        else:
            as_list.append(i.lower())

    return ''.join(as_list)
306701
def camelcase2list(s, lower=False):
    """"""
    s = re.findall(r'([A-Z][a-z0-9]+)', s)
    return [w.lower() for w in s] if lower else s
58502
function camelCase(s) {
  return s.toLowerCase().replace(/-(.)/g, function(m, g) {
    return g.toUpperCase()
  })
}
561178
function lowcaseKeys(h) {
  return _.transform(h, function(result, v, k) {
    result[k.toLowerCase()] = v;
  });
}
949661
def camel_case_from_underscores(string):
    """"""
    components = string.split('_')
    string = ''
    for component in components:
        string += component[0].upper() + component[1:]
    return string
458200
function snakeCase(str) {
            return camelCase(str).replace(reCamelCase, function (all, letter) {
                return "-" + letter.toLowerCase();
            });
        }
535927
private static String camelCaseToSentenceCase(String camelCase) {
        String name = StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(camelCase), " ");
        return name.substring(0, 1).toUpperCase(Locale.ENGLISH) + name.substring(1)
                .toLowerCase(Locale.ENGLISH);
    }
483042
def downcaseTokens(s,l,t):
    """"""
    return [ tt.lower() for tt in map(_ustr,t) ]
159200
public static String underScore2CamelCase(String strs) {

        if (strs == null || !strs.contains("_")) {
            return strs;
        }
        StringBuilder sb = new StringBuilder("");
        String[] elems = strs.split("_");
        for (int i = 0; i < elems.length; i++) {
            String elem = elems[i].toLowerCase();
            if (i != 0) {
                char first = elem.toCharArray()[0];
                sb.append((char) (first - 32)).append(elem.substring(1));
            } else {
                sb.append(elem);
            }
        }
        return sb.toString();
    }
988910
def lower_case(f):
    """"""
    # if it has already been wrapped, we return original
    if hasattr(f, "lower_cased"):
        return f

    @wraps(f)
    def wrapper(*args, **kwargs):
        f.lower_cased = True
        return f(*args, **kwargs).lower()

    return wrapper
889218
def camel_case_from_underscores(string):
    """"""

    components = string.split('_')
    string = ''

    for component in components:
        if component in abbreviations:
            string += component
        else:
            string += component[0].upper() + component[1:].lower()

    return string
1019848
function camelCase (str) {
  return ('' + str).replace(/(-[a-zA-Z])/g, function (text, u) {
    return u.substring(1).toLocaleUpperCase()
  })
}
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)))
1270908
function camelcase(val) {
    if (!is_1.isValue(val))
        return null;
    var result = val.replace(/[^A-Za-z0-9]/g, ' ').replace(/^\w|[A-Z]|\b\w|\s+/g, function (m, i) {
        if (+m === 0 || /(\.|-|_)/.test(m))
            return '';
        return i === 0 ? m.toLowerCase() : m.toUpperCase();
    });
    return result.charAt(0).toLowerCase() + result.slice(1);
}
1023437
def convert_case(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()
1319612
function camelCaseToUnderscoreMap(columns) {
    var map = {};
    for (var i = 0; i < columns.length; i++)
        map[columns[i]] = toUnderscore(columns[i]);
    return map;
}
90893
public static String underscoreSeparated(String camelCaseName) {
        return StringUtils.lowerCase(
                Arrays.stream(StringUtils.split(camelCaseName, SubFacet.SEPARATOR))
                        .flatMap(component -> Arrays.stream(StringUtils.splitByCharacterTypeCamelCase(component)))
                        .collect(Collectors.joining("_")));
    }