Node.js examples for String:Trim
LTrim() - returns a string with Left blank spaces removed
function LTrim(str) { var whitespace = new String(" \t\n\r"); var s = new String(str); if (whitespace.indexOf(s.charAt(0)) != -1) { var j=0//from w w w. jav a2 s . c o m var i = s.length; while (j < i && whitespace.indexOf(s.charAt(j)) != -1) { j++; } s = s.substring(j, i); } return s; }