Javascript String toSentence()

Description

Javascript String toSentence()

String.prototype.toSentence = function() {
  return this.replace(/^[a-z]|[A-Z]/g, function(v, i) {
    return i === 0 ? v.toUpperCase() : " " + v.toLowerCase();
  });//w  ww.  ja v  a2 s . c om
};



PreviousNext

Related