Node.js examples for String:Parse
Is String a Float Number
String.prototype.isFloat = function() { var checkOK = "0123456789-,."; var checkStr = this; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i);/*w w w .j a va 2 s. c o m*/ for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } if ((ch == '-') && (i != 0)) { allValid = false; break; } if (ch != ",") allNum += ch; if (ch == ".") decPoints += 1; } if (decPoints > 1) { allValid = false; } return (allValid) }