returns a string with leading Zeros and blank spaces removed - Node.js String

Node.js examples for String:String Value

Description

returns a string with leading Zeros and blank spaces removed

Demo Code

function LTrimZero(str) {
  var whitespace = new String("0 \t\n\r");
  var s = new String(str);

  if (whitespace.indexOf(s.charAt(0)) != -1) {
    var j=0//from w  ww.ja v a 2  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;
}

Related Tutorials