Javascript String ellipse(maxLength)
String.prototype.ellipse = function(maxLength){ if(this.length > maxLength){ return this.substr(0, maxLength-3) + '...'; } return this;//from w ww.j ava 2 s .c o m };