Here you can find the source of trim()
String.prototype.trim = function(){ //from ww w . j a va2 s.co m var start,end; start=0; end=this.length-1; while(start<=end && this.charAt(start)==' '){ start++; } while(start<=end && this.charAt(end)==" "){ end--; } return this.substring(start,end+1); }
String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g,''); }; String.prototype.ltrim = function() { return this.replace(/^\s+/,''); }; String.prototype.rtrim = function() { return this.replace(/\s+$/,''); }; ...
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); } function isProbablyUrl(string) { var substr = string.substring(0,4).toLowerCase(); if (substr == 'ftp:' || substr == 'www.') return true; var substr = string.substring(0,5).toLowerCase(); if (substr == 'http:') return true; var substr = string.substring(0,6).toLowerCase(); if (substr == 'https:') return true; var substr = string.substring(0,7).toLowerCase(); ...
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, "");
String.prototype.trim=function() return this.replace(/^\s+|\s+$/g, ''); String.prototype.ltrim=function() return this.replace(/^\s+/,''); String.prototype.rtrim=function() ...
String.prototype.trim = function() { this.replace(/(^\s*)|(\s*$)/gi,''); this.replace(/[ ]{2,}/gi,' '); this.replace(/\n /,'\n'); return this; };
Array.isArray = Array.isArray || function (obj) { return toString.call(obj) === '[object Array]'; }; String.prototype.trim = String.prototype.trim || function () { var str = this.replace(/^\s\s*/, ''), i = str.length; for (let rgxp = /\s/; rgxp.test(str.charAt(--i));) {} return str.substring(0, i + 1); }; ...
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,"");
String.prototype.trim = function() { return this.replace(/\s/g, "");
String.prototype.trim= function() var str= this.replace(/^\s+/, ''); for (var i = str.length - 1; i > 0; --i) if (/\S/.test(str.charAt(i))) str = str.substring(0, i + 1); break; return str;