Javascript String shorten(length)
String.prototype.shorten = function(length){ if(this.length <= length) return this; return this.substring(0,length - 3) + '...'; } //String.prototype.nullIfEmpty = function(){ // if(this)/*from ww w.ja v a 2s. c om*/ // return this; // else // return null; //}