Nodejs String Capitalize capitalize()

Here you can find the source of capitalize()

Method Source Code

/** // w  w  w  .  j  a  v a2  s. co  m
 * Nimbus - Manage, Share & Collaborate
 *
 * Nimbus is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * see LICENSE for more Copyright goodness.
 *
 * @package:      Nimbus
 * @copyright:   2009-2010, Nimbus Dev Group, All rights reserved.
 * @license:      GNU/GPLv3, see LICENSE
 * @version:      1.0.0 Alpha
 */
String.prototype.capitalize = function(){ //v1.0
    return this.replace(/\w+/g, function(a){
        return a.charAt(0).toUpperCase() + a.substr(1).toLowerCase();
    });
};

Related

  1. capitalize()
    String.prototype.capitalize = function() {
      return this.charAt(0).toUpperCase() + this.substr(1);
    };
    
  2. capitalize()
    String.prototype.capitalize = function() {
      return this.charAt(0).toUpperCase() + this.slice(1);
    };
    String.prototype.doubleQuote = function() {
      return '"' + this + '"';
    };
    
  3. capitalize()
    String.prototype.capitalize = function() {
        return this.charAt(0).toUpperCase() + this.slice(1);
    
  4. capitalize()
    String.prototype.capitalize = function() {
       return this.charAt(0).toUpperCase() + this.slice(1);
    String.prototype.titleize = function() {
       var string_array = this.split(' ');
       string_array = string_array.map(function(str) {
          return str.capitalize();
       });
       return string_array.join(' ');
    ...
    
  5. capitalize()
    String.prototype.capitalize = function(){
      var val = this;
      return val[0].toUpperCase() + val.substring(1);
    
  6. capitalize()
    String.prototype.capitalize = function() {
      return this.charAt(0).toUpperCase() + this.slice(1);
    };
    $.fn.ensureVisible = function () { $(this).each(function () { $(this)[0].scrollIntoView(); }); };
    
  7. capitalize()
    String.prototype.capitalize = function(){
      return this.replace(/\S+/g, function(a){
        return a.charAt(0).toUpperCase() + a.slice(1).toLowerCase();
      });
    };
    
  8. capitalize()
    String.prototype.capitalize = function() {
        return this.charAt(0).toUpperCase() + this.slice(1);
    };
    Array.prototype.equalTo = function (array) {
        if (!array)
            return false;
        if (this.length != array.length)
            return false;
        for (var i = 0, l=this.length; i < l; i++) {
    ...
    
  9. capitalize()
    String.prototype.capitalize = function() {
      if (this.length == 1)
        return this.toUpperCase();
      return this.substr(0, 1).toUpperCase() + this.substr(1);
    };