Javascript String capitalise()

Description

Javascript String capitalise()


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

String.prototype.capitalize = String.prototype.capitalise

Javascript String capitalise()

/*//from  ww w  .  ja va 2 s  .c o  m
 *
 * Extend Javascript primitives because Javascript is frustratingly limited.
 *
 */

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

Javascript String capitalise()

String.prototype.capitalise = function() {
  return this.replace(this.substr(0,1),this.substr(0,1).toUpperCase());
}

function getURLParam (oTarget, sVar) {
  return decodeURI(oTarget.search.replace(new RegExp("^(?:.*[&\\?]" + encodeURI(sVar).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1"));
}



PreviousNext

Related