Here you can find the source of ltrim()
String.prototype.ltrim = function(){ var res = this; while (res.substring(0, 1) == " ") { res = res.substring(1, res.length); }//from w w w . j a v a 2 s .c om return res; }
String.prototype.ltrim = function() { return this.replace(/(^\s*)/g, "");
String.prototype.ltrim = function() { return this.replace(/^\s+/,'');
String.prototype.ltrim = function(){ return this.replace(/\s+$/, ""); };
String.prototype.ltrim = function(){ return this.replace(/^\s+/, ""); };
String.prototype.ltrim = function() return this.replace( /^\s*/g, '' ) ;
String.prototype.ltrim=function() {return this.replace(/^\s+/,'');}
String.prototype.ltrim = function(ch) { var r = new RegExp("^{0}+".format(ch || "\\s")); return this.replace(r, ""); };
String.prototype.ltrim = function (charlist) { charlist = !charlist ? ' \\s\u00A0' : (charlist + '').replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '$1'); var re = new RegExp('[' + charlist + ']+$', 'g'); return this.replace(re, ''); };
String.prototype.trimLeft = function() { return this.replace(/^\s+/, ''); };