您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

capitalize.js 529B

1234567891011121314151617181920212223
  1. var toString = require('./toString'),
  2. upperFirst = require('./upperFirst');
  3. /**
  4. * Converts the first character of `string` to upper case and the remaining
  5. * to lower case.
  6. *
  7. * @static
  8. * @memberOf _
  9. * @since 3.0.0
  10. * @category String
  11. * @param {string} [string=''] The string to capitalize.
  12. * @returns {string} Returns the capitalized string.
  13. * @example
  14. *
  15. * _.capitalize('FRED');
  16. * // => 'Fred'
  17. */
  18. function capitalize(string) {
  19. return upperFirst(toString(string).toLowerCase());
  20. }
  21. module.exports = capitalize;