Converts hyphens and camel casing to underscores.

@param  {String} str String to convert
@return {String}
495311
function underscore(str) {
        return str.replace(/[-\s]+/g, '_').replace(/([A-Z\d]+)([A-Z][a-z])/g, '$1_$2').replace(/([a-z\d])([A-Z])/g, '$1_$2').toLowerCase();
    }
1080943
def underscore_string(str)
        str.to_s.strip.
          gsub(' ', '_').
          gsub(/::/, '/').
          gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
          gsub(/([a-z\d])([A-Z])/,'\1_\2').
          tr("-", "_").
          squeeze("_").
          downcase
      end
31829
function(str) {
      if (typeof str !== 'string') {
        str = this.content;
      }
      if (typeof str !== 'string') return '';
      str = str.replace(/(<([^>]+)>)/g, '');
      return str.trim();
    }
849028
function camelise(str) { var re
        re = /[\s\-_]+(\w)/g
        return downcase(str).replace(re, function(match, letter) {
            return upcase(letter) })
    }
616208
function stringify(str) {
            if (!str) {
                return str;
            }

            var newStr = '';
            for (var i = 0, l = str.length, ch; i < l; i++) {
                ch = str.charCodeAt(i);
                if (ch === 0) {
                    continue;
                }
                newStr += String.fromCharCode(ch);
            }
            return newStr;
        }
931919
function snakeCase (str) {
  return str
    .replace(/([a-z])([A-Z])/g, match => match[0] + '_' + match[1])
    .replace(invalidChars, '_')
    .toLowerCase()
}
801143
function(str) {
      if (v.isNumber(str)) {
        // If there are more than 2 decimals round it to two
        if ((str * 100) % 1 === 0) {
          return "" + str;
        } else {
          return parseFloat(Math.round(str * 100) / 100).toFixed(2);
        }
      }

      if (v.isArray(str)) {
        return str.map(function(s) { return v.prettify(s); }).join(", ");
      }

      if (v.isObject(str)) {
        return str.toString();
      }

      // Ensure the string is actually a string
      str = "" + str;

      return str
        // Splits keys separated by periods
        .replace(/([^\s])\.([^\s])/g, '$1 $2')
        // Removes backslashes
        .replace(/\\+/g, '')
        // Replaces - and - with space
        .replace(/[_-]/g, ' ')
        // Splits camel cased words
        .replace(/([a-z])([A-Z])/g, function(m0, m1, m2) {
          return "" + m1 + " " + m2.toLowerCase();
        })
        .toLowerCase();
    }
1324526
function(str){
            str = (str || "").toString();
            str = str.replace(/\=(?:\r?\n|$)/g, "");
            var str2 = "";
            for(var i=0, len = str.length; i<len; i++){
                chr = str.charAt(i);
                if(chr == "=" && (hex = str.substr(i+1, 2)) && /[\da-fA-F]{2}/.test(hex)){
                    str2 += String.fromCharCode(parseInt(hex,16));
                    i+=2;
                    continue;
                }
                str2 += chr;
            }
            return str2;
        }
747954
public static function camelize($str)
    {
        if (strpos($str, '_') !== false) {
            if (PHP_VERSION_ID >= 50516) {
                //http://php.net/manual/en/function.ucwords.php
                return str_replace('_', '', ucwords($str, '_'));
            } else {
                $parts = explode('_', $str);
                foreach ($parts as $k => $v) {
                    $parts[$k] = ucfirst($v);
                }

                return implode('', $parts);
            }
        } else {
            return ucfirst($str);
        }
    }
1345452
function dashCase(str) {
        var newStr = '';

        for (var i = 0, len = str.length; i < len; i++) {
            if (str[i] === str[i].toUpperCase()) { newStr += '-'; }
            newStr += str[i].toLowerCase();
        }

        return newStr;
    }
271734
private static String hyphenatedToCamelCase(String s) {
        Matcher m = Pattern.compile("(?:^|-)([a-z])").matcher(s);
        StringBuilder b = new StringBuilder();
        int last = 0;
        for (; m.find(); last = m.end()) {
            b.append(s, last, m.start()).append(Character.toUpperCase(m.group(1).charAt(0)));
        }
        return b.append(s, last, s.length()).toString();
    }
1278954
public static String hypenToCamelNotation(String str) {
	if (isEmpty(str)) return str;

	StringBuilder sb = new StringBuilder();
	int len = str.length();
	char c;

	for (int i = 0; i < str.length(); i++) {
	    c = str.charAt(i);
	    if (c == '-') {
		if (len > ++i) sb.append(Character.toUpperCase(str.charAt(i)));
	    }
	    else sb.append(c);
	}
	return sb.toString();
    }
828271
function dasherize(str) {
  return str.replace(
      /([a-z])([A-Z])/g,
    (_, let1, let2) => `${let1}-${let2.toLowerCase()}`
  );
}
1226791
public static function underscore(string $str): string
    {
        $result = preg_replace(
            [
                '/([A-Z]+)([A-Z][a-z])/',
                '/([a-z\d])([A-Z])/',
            ],
            [
                '\\1_\\2',
                '\\1_\\2',
            ],
            str_replace('_', '.', static::removeMultipleSpaces($str))
        );

        return mb_strtolower($result);
    }
404039
function camelToUnderscore(str) {
            return s.split(/(?=[A-Z])/).map(function (p) {
                return p.charAt(0).toUpperCase() + p.slice(1);
            }).join('_');
        }
1115759
public static String toTitleCase(String str) {
        if (str.length() == 0) {
            return str;
        } else {
            return Character.toUpperCase(str.charAt(0)) + str.substring(1).toLowerCase();
        }
    }
249962
function camelCase(str) {
    // Replace special characters with a space
    str = str.replace(/[^a-zA-Z0-9 ]/g, ' ');
    // put a space before an uppercase letter
    str = str.replace(/([a-z](?=[A-Z]))/g, '$1 ');
    // Lower case first character and some other stuff
    str = str.replace(/([^a-zA-Z0-9 ])|^[0-9]+/g, '').trim().toLowerCase();
    // uppercase characters preceded by a space or number
    str = str.replace(/([ 0-9]+)([a-zA-Z])/g, function (a, b, c) {
        return b.trim() + c.toUpperCase();
    });
    return str;
}