Here you can find the source of trimToLength(m)
String.prototype.trimToLength = function(m) { return (this.length > m) ? jQuery.trim(this).substring(0, m).split(" ").slice(0, -1).join(" ") + "..." : this;// ww w .j a v a2 s. c o m };
String.prototype.trimSpaces = function () { var phrases = this.split(" "); var result = ""; for (var i = 0; i < phrases.length; i++) { if (!phrases[i]=="") { if (result=="") { result = phrases[i]; } else { result += " " + phrases[i]; ...
String.prototype.trimStart=function(c) c = c?c:' '; var i=0; for(;i<this.length && this.charAt(i)==c; i++); return this.substring(i);
String.prototype.trimStart = function(s) { return this.replace(new RegExp("^" + s + "+", "gm"), "");
String.prototype.trim = function String_trim() this.replace(/^\s+/m, '').replace(/\s+$/m, '');
String.prototype.trimTailChars = function(c){ var idx, len = this.length; var tmp = this; while(len--){ idx = tmp.lastIndexOf(c); if(idx == -1) { break; tmp = tmp.substring(0,idx); ...
String.prototype.trimToLength = function(m) { return (this.length > m) ? jQuery.trim(this).substring(0, m).split(" ").slice(0, -1).join(" ") + "..." : this; };
String.prototype.trimToLength = function(m) { return (this.length > m) ? jQuery.trim(this).substring(0, m).split(' ').slice(0, -1).join(' ') : this.replace('"', ''); };
String.prototype.trimToPx = function(length) var tmp = this; var trimmed = this; if (tmp.visualLength() > length) trimmed += "..."; while (trimmed.visualLength() > length) tmp = tmp.substring(0, tmp.length-1); trimmed = tmp + "..."; return trimmed;
String.prototype.trimTrailZeroes = function() { return this.replace(/(.\d*?)0+$/, "$1").replace(/\.$/, ""); };