Here you can find the source of trunc(n)
String.prototype.trunc = function(n) { 'use strict';//ww w . j av a 2 s. co m return this.length > n ? this.substr(0, n-1) + '...' : this; };
String.prototype.trunc = String.prototype.trunc || function(n){ return this.length>n ? this.substr(0,n-1)+'?' : this; };
String.prototype.trunc = String.prototype.trunc || function(n){ return this.length>n ? this.substr(0,n-1)+'...' : this; };
String.prototype.trunc = function(len,suffix) { return this.length > len ? this.slice(0, len) + (suffix||'…') : this; };
String.prototype.trunc = String.prototype.trunc || function(len,suffix) { return this.length > len ? this.slice(0, len) + (suffix||'…') : this; };
String.prototype.trunc = function(length, options) { var defaults = Ext.Object.merge({omission: "..."}, options || {}); var stop = length - defaults.omission.length; return (this.length > length ? this.substring(0, stop) + defaults.omission : this).toString(); };
String.prototype.trunc = String.prototype.trunc || function(n){ return (this.length > n) ? this.substr(0,n-1)+'…' : this; };
String.prototype.trunc = function(n) { return this.substr(0,n-1)+(this.length>n?'...':''); };
String.prototype.trunc = function(n){ var isTooLong = this.length > n; var string = isTooLong ? this.substr(0,n) : this; string = isTooLong ? string.substr(0, string.lastIndexOf(' ')) : string; return isTooLong ? string + '...' : string; };
String.prototype.trunc = function(n) { var longStr = this.length > n; var str = longStr ? this.slice(0, n) : this; longStr ? str = str.slice(0, str.lastIndexOf(' ')) : str; return longStr ? str + '...' : str;