Is String decimal - Node.js String

Node.js examples for String:Parse

Description

Is String decimal

Demo Code

function isDecimal(str) {

  var re = /^[-]{0,1}(\d+)[\.]+(\d+)$/;
  if (re.test(str)) {
    if (RegExp.$1 == 0 && RegExp.$2 == 0)
      return false;
    return true;/*from  w  w w.j  av  a2s .  com*/
  } else {
    return false;
  }
}

Related Tutorials