Javascript String ucfirst()
function isset(args) { return (typeof args !== 'undefined' && args !== null); } String.prototype.ucfirst = function() { return this.charAt(0).toUpperCase() + this.substr(1); };
String.prototype.ucfirst = function() { return this.charAt(0).toUpperCase() + this.slice(1); }
String.prototype.ucfirst = function() { return this.charAt(0).toUpperCase() + this.slice(1); };
String.prototype.ucfirst = function() { return this.substr(0, 1).toUpperCase() + this.substr(1, this.length); };
String.prototype.ucfirst = function() { var str = this; if(str.length) { str = str.charAt(0).toUpperCase() + str.slice(1); }//from w w w. ja va 2 s .c o m return str; };
/* Function that returns the string with the first letter as uppercase */ String.prototype.ucfirst = function () { return this.charAt(0).toUpperCase() + this.slice(1); };
String.prototype.ucfirst = function() { return this.charAt( 0 ).toUpperCase() + this.substr( 1 ); };
String.prototype.ucfirst = function() { this.toLowerCase().replace(/\b([a-z])/, function(c){ return c.toUpperCase(); });/*from www . j av a 2 s . c o m*/ };
/**/*from w w w . ja va2 s . c o m*/ * Main Vanilla JS file */ String.prototype.ucFirst = function(){ return this.charAt(0).toUpperCase() + this.slice(1); }
// usage example/*from w w w . j ava 2s. c o m*/ //"hello".ucFirst(); // --> Hello String.prototype.ucFirst = function() { var str = this; if(str.length) { str = str.charAt(0).toUpperCase() + str.slice(1); } return str; };
String.prototype.ucfirst = function() { var aString = this; var aResult = aString.charAt(0).toUpperCase(); for (var i=1;i<aString.length;i++) { aResult += aString.charAt(i);//www . j a v a 2 s .co m } return aResult; }
String.prototype.ucFirst = function() { return this.charAt(0).toUpperCase() + this.slice(1); };
String.prototype.ucfirst = function() { return this.charAt(0).toUpperCase() + this.substr(1); };
String.prototype.ucfirst = function(){ return this.charAt(0).toUpperCase() + this.substring(1, this.length); }
String.prototype.ucfirst = function() { str = '' + this; var f = str.charAt(0) .toUpperCase();/*from w w w . j a va 2 s .c om*/ return f + str.substr(1); }
String.prototype.ucfirst = function() { return this.charAt(0).toUpperCase() + this.substr(1); }
/**//from w ww .j a va 2 s . c o m * A collection of extension for the native JavaScript * extended using the prototype */ String.prototype.ucfirst = function () { return this.charAt(0).toUpperCase() + this.slice(1); };
// ucfirst.js/*from w w w . j a va 2s.c om*/ String.prototype.ucfirst = function () { return this.charAt(0).toUpperCase() + this.slice(1); }
String.prototype.ucfirst = function () { if (this.charAt(1).match(/[a-z]/)) { return this.charAt(0).toUpperCase() + this.slice(1); } else {/*w w w . j a v a 2 s . c om*/ return this; } };
/**/*w w w .j a v a 2s. com*/ * Upper Case First character in string. * @returns {string} */ String.prototype.ucFirst = function () { return this[0].toUpperCase() + this.slice(1); }
/**// ww w .jav a 2s .c om * Make a string's first character uppercase * * `hello world` --> `Hello world` * * @return {string} */ String.prototype.ucfirst = function ucfirst() { return this.split('').map(function(char, i) { return i === 0 ? char.toUpperCase() : char }).join(''); };
String.prototype.ucfirst = function() { // Split the string into words if string contains multiple words. var x = this.split(/\s+/g); for (var i = 0; i < x.length; i++) { // Splits the word into two parts. One part being the first letter, // second being the rest of the word. var parts = x[i].match(/(\w)(\w*)/); // Put it back together but uppercase the first letter and lowercase the // rest of the word. x[i] = parts[1].toUpperCase() + parts[2].toLowerCase(); }//from w ww . ja v a 2s . c om // Rejoin the string and return. return x.join(' '); };
/**/* www. j a va 2 s .c om*/ * Uppercase first letter * @returns */ String.prototype.ucFirst = function() { return this.charAt(0).toUpperCase()+this.slice(1); } Element.prototype.toggleAttribute = function(name, value = "") { if ( this.hasAttribute(name) ) { this.removeAttribute(name); } else { this.setAttribute(name, value); } }
/**/* w w w . ja v a 2 s.co m*/ @function */ String.prototype.ucfirst = function() { return this.substr(0, 1).toUpperCase() + this.substr(1, this.length); };
String.prototype.ucFirst = function() { return this.replace(/[a-z]/i, (x) => x.toUpper()); };