Turns the first letter of a string to upper-case.

@param {String} str
@param {Boolean} [keepCase] Keep the case of 2nd to last letter.
@returns {String}
345515
function( str, keepCase ) {
			return str.charAt( 0 ).toUpperCase() + ( keepCase ? str.slice( 1 ) : str.slice( 1 ).toLowerCase() );
		}
121634
private function underscoreToCamelcase($str)
    {
        // Split string in words.
        $words = explode('_', strtolower($str));

        $return = '';

        foreach ($words as $word) {
            $return .= ucfirst(trim($word));
        }

        return $return;
    }
571463
public static String lowerCase(String str) {
        if(isNullOrEmpty(str)) {
            return str;
        }
        return str.toLowerCase(LOCALE_ENGLISH);
    }
29837
private static boolean isNameCase(String str) {
    if (str.length() < 2) {
      return false;
    }
    if (!(Character.isUpperCase(str.charAt(0)) || Character.isTitleCase(str.charAt(0)))) {
      return false;
    }
    for (int i = 1; i < str.length(); i++) {
      if (Character.isUpperCase(str.charAt(i))) {
        return false;
      }
    }
    return true;
  }
638905
public static String toUpperCaseWithUnderscore(final String str) {
        if (N.isNullOrEmpty(str)) {
            return str;
        }

        String result = upperCaseWithUnderscorePropNamePool.get(str);

        if (result == null) {
            result = StringUtil.toUpperCaseWithUnderscore(str);
            upperCaseWithUnderscorePropNamePool.put(str, result);
        }

        return result;
    }
904930
function strToBoolean(str) {
    switch (str && str.toLowerCase && str.toLowerCase()) {
        case 'true':
            return true;
        case 'false':
            return false;
        case 'null':
            return null;
    }
    return undefined;
}
1318877
public static String toCamelCase(String str) {
		String[] wordList = str.toLowerCase().split("_");
		String finalStr = "";
		for (String word : wordList) {
			finalStr += capitalize(word);
		}
		return finalStr;
	}
407762
function (str) {

		var self = this;

		if ('i' !== 'I'.toLowerCase()) {
			// Thanks for http://qiita.com/niusounds/items/fff91f3f236c31ca910f
			return str.replace(/[a-z]/g, function(ch) {
				return String.fromCharCode(ch.charCodeAt(0) & ~32);
			});
		}

		return str.toUpperCase();

	}
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;
    }
642888
function snakeCase(str, { upperCase = false, underscoreBeforeDigits = false } = {}) {
  if (str.length === 0) {
    return str;
  }

  const upper = str.toUpperCase();
  const lower = str.toLowerCase();

  let out = lower[0];

  for (let i = 1, l = str.length; i < l; ++i) {
    const char = str[i];
    const prevChar = str[i - 1];

    const upperChar = upper[i];
    const prevUpperChar = upper[i - 1];

    const lowerChar = lower[i];
    const prevLowerChar = lower[i - 1];

    // If underScoreBeforeDigits is true then, well, insert an underscore
    // before digits :). Only the first digit gets an underscore if
    // there are multiple.
    if (underscoreBeforeDigits && isDigit(char) && !isDigit(prevChar)) {
      out += '_' + char;
      continue;
    }

    // Test if `char` is an upper-case character and that the character
    // actually has different upper and lower case versions.
    if (char === upperChar && upperChar !== lowerChar) {
      // Multiple consecutive upper case characters shouldn't add underscores.
      // For example "fooBAR" should be converted to "foo_bar".
      if (prevChar === prevUpperChar && prevUpperChar !== prevLowerChar) {
        out += lowerChar;
      } else {
        out += '_' + lowerChar;
      }
    } else {
      out += char;
    }
  }

  if (upperCase) {
    return out.toUpperCase();
  } else {
    return out;
  }
}
2800
public static function toCamelCase($str, $upperFirstChar = false)
    {
        $str = self::strtolower($str);

        if ($upperFirstChar) {
            $str = self::ucfirst($str);
        }

        return preg_replace_callback('/_+([a-z])/', function ($c) {
            return strtoupper($c[1]);
        }, $str);
    }
751516
protected function fromCamelCase($str)
    {
        $func = function ($str) {
            return ' '.$str[0];
        };

        $value = preg_replace_callback('/([A-Z])/', $func, $str);
        $value = ucfirst($value);

        return trim($value);
    }
1182987
public static int getStringCase(String str) {
        if (str.length() == 0) {
            return MIXED;
        }

        int state = -1;

        char ch = str.charAt(0);
        if (Character.isLetter(ch)) {
            if (Character.isUpperCase(ch)) {
                state = UPPER_CASE;
            } else {
                state = LOWER_CASE;
            }
        }

        for (int i = 1; i < str.length(); i++) {
            ch = str.charAt(i);
            if (!Character.isLetter(ch)) {
                continue;
            }

            switch (state) {
                case UPPER_CASE:
                    if (Character.isLowerCase(ch)) {
                        if (i == 1) {
                            state = TITLE_CASE;
                        } else {
                            return MIXED;
                        }
                    }
                    break;
                case LOWER_CASE:
                case TITLE_CASE:
                    if (Character.isUpperCase(ch)) {
                        return MIXED;
                    }
                    break;
            }
        }

        return state;
    }
540010
def uppercase_chars(string: any) -> str:
        """"""
        return ''.join([c if c.isupper() else '' for c in str(string)])
409465
function _toCamelCase(str) {
  var newString = '';
  var insideParens = false;
  newString += str[0].toLowerCase();
  for (var i = 1; i < str.length; i++) {
    var char = str[i];
    switch (char) {
      case ')':
      case '_':
        break;
      case '(':
        insideParens = true;
        break;
      default:
        if (insideParens) {
          insideParens = false;
          newString += char.toUpperCase();
        } else {
          newString += char;
        }
        break;
    }
  }

  return newString;
}
1257135
function (str) {
		return str.replace
		(/(^[a-z]+)|[0-9]+|[A-Z][a-z]+|[A-Z]+(?=[A-Z][a-z]|[0-9])/g
			, function (match, first) {
				if (first) match = match[0].toUpperCase() + match.substr(1);
				return match + ' ';
			}
		)
	}
1250220
function splitWords(str) {
    return str
        // insert a space between lower & upper
        .replace(/([a-z])([A-Z])/g, '$1 $2')
        // space before last upper in a sequence followed by lower
        .replace(/\b([A-Z]+)([A-Z])([a-z])/, '$1 $2$3')
        // uppercase the first character
        .replace(/^./, function(str){ return str.toUpperCase(); })
}