Javascript String capitalizeFirstLetter()

Description

Javascript String capitalizeFirstLetter()


'use strict';/*from ww  w  . j ava  2  s.  c  om*/

String.prototype.capitalizeFirstLetter = function() {
  return this.charAt(0).toUpperCase() + this.slice(1);
}

Javascript String capitalizeFirstLetter()

String.prototype.capitalizeFirstLetter = function() {
  return this.charAt(0).toUpperCase() + this.slice(1);
}

String.prototype.titleize = function() {
  return this.capitalizeFirstLetter();
}

Javascript String capitalizeFirstLetter()

/**//from   ww w .j  a  v  a  2  s .  c  o  m
 * 
 * We will add all the helper methods in this file
 * 
 */

String.prototype.capitalizeFirstLetter = function() {
    return this.charAt(0).toUpperCase() + this.slice(1);
};

Javascript String capitalizeFirstLetter()

// Prototype/*w  w w .  j a  va 2  s .c  o  m*/
String.prototype.capitalizeFirstLetter = function() {
  return this.charAt(0).toUpperCase() + this.slice(1);
}

Javascript String capitalizeFirstLetter()

String.prototype.capitalizeFirstLetter = function() {
    return this.charAt(0).toUpperCase() + this.slice(1);
}

if (!String.prototype.format) {
  String.prototype.format = function() {
    var args = arguments;
    return this.replace(/{(\d+)}/g, function(match, number) { 
      return typeof args[number] != 'undefined'
        ? args[number]//from   w w  w  .  j a v a  2  s .c  o m
        : match
      ;
    });
  };
}

Javascript String capitalizeFirstLetter()

String.prototype.capitalizeFirstLetter = function() {
 return this.charAt(0).toUpperCase() + this.slice(1);
}  //http://stackoverflow.com/a/1026087
function isJson(str) {
 try { JSON.parse(str); } catch (e) { return false; }
 return true;/*from  w ww.  ja v a  2s  . c  o  m*/
}  //http://stackoverflow.com/a/9804835

Javascript String capitalizeFirstLetter()

String.prototype.capitalizeFirstLetter = function(){
     return this[0].toUpperCase() + this.slice(1);
}

Javascript String capitalizeFirstLetter()

'use strict;'//  w  w w . ja v a 2  s.  c om

String.prototype.capitalizeFirstLetter = function () {
 return this.charAt(0).toUpperCase() + this.slice(1);
};

String.prototype.format = function () {
 var args = arguments;
    return this.replace(/{(\d+)}/g, function(match, number) { 
      return typeof args[number] != 'undefined'
        ? args[number]
        : match;
    }); 
};

String.prototype.splitWord = function () {
 return this.split(/(?=[A-Z])/).join(' ');
};

Javascript String capitalizeFirstLetter()

/**/* w  ww.j a va 2  s.co  m*/
* Following are some examples of string extention methods.
* Here we are adding new functionality to String datatype.
* This functionality will be available to the Object which is Instance of String.
*/

String.prototype.capitalizeFirstLetter = function () {
    return this.charAt(0).toUpperCase() + this.slice(1);
};

Javascript String capitalizeFirstLetter()

/*****************************************************************************/
/* Client and Server Helpers */
/*****************************************************************************/

function capitalizeFirstLetter(string) {
    return string.charAt(0).toUpperCase() + string.slice(1);
}
String.prototype.capitalizeFirstLetter = function() {
    return this.charAt(0).toUpperCase() + this.slice(1);
}



PreviousNext

Related