Nodejs String to Upper Case uppercaseFirstLetter()

Here you can find the source of uppercaseFirstLetter()

Method Source Code

/******************************************************
Description:/* w  w w .  j a  va  2  s.  c  o m*/
   Extend the String object with additional functions

Parameters:
   -
******************************************************/

/******************************************************
   Make the first letter to ah capital letter.
******************************************************/
String.prototype.uppercaseFirstLetter = function() {
    return this.charAt(0).toUpperCase() + this.slice(1);
};

Related

  1. upperCaseFirst()
    String.prototype.upperCaseFirst = function() {
      return this.replace(/^./, function(a) {
        return a.toUpperCase();
      });
    };
    
  2. upperFirstChar()
    String.prototype.upperFirstChar = function() {
      return this.charAt(0).toUpperCase() + this.slice(1)
    
  3. upperFirstLetter()
    String.prototype.upperFirstLetter = function() {
        return this.charAt(0).toUpperCase() + this.slice(1);
    
  4. upperInitial()
    String.prototype.upperInitial = function() {
      return this.replace(/(^|\s+)\w/g, function(s) {
        return s.toUpperCase();
      });
    };
    
  5. uppercase()
    String.prototype.uppercase = function() { return this.toUpperCase() };