Nodejs String Capitalize capitalize()

Here you can find the source of capitalize()

Method Source Code

String.prototype.capitalize = function() {
    return this.replace(/(?:^|\s)\S/g, function(a) { return a.toUpperCase(); });
};

Related

  1. capitalise()
    String.prototype.capitalise = function() {
        var input = this;
        var capitalisedString = input.replace(input, input.charAt(0).toUpperCase() + input.substr(1).toLowerCase());
        return capitalisedString;
    
  2. capitaliseFirstLetter()
    String.prototype.capitaliseFirstLetter = function() {
      return this.charAt(0).toUpperCase() + this.toLowerCase().slice(1);
    
  3. capitaliseFirstLetter()
    String.prototype.capitaliseFirstLetter = function() {
      return this.charAt(0).toUpperCase() + this.slice(1);
    String.prototype.isBlank = function() {
      return (this.trim() == "");
    
  4. capitaliseFirstLetter()
    String.prototype.capitaliseFirstLetter = function()
        return this.charAt(0).toUpperCase() + this.slice(1);
    };
    
  5. capitalize()
    String.prototype.capitalize = function() {
        return this.charAt(0).toUpperCase() + this.slice(1);
    
  6. capitalize()
    String.prototype.capitalize = function() {
      return this[0].toUpperCase() + this.slice(1);
    
  7. capitalize()
    String.prototype.capitalize = function () {
      return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase();
    
  8. capitalize()
    String.prototype.capitalize = function() {
      return this.slice(0, 1).toUpperCase() + this.slice(1).toLowerCase();
    };
    
  9. capitalize()
    String.prototype.capitalize = function () {
        'use strict';
        return this.charAt(0).toUpperCase() + this.slice(1);
    };