Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CVSParser.isNumber() function not performing as expected #5

Open
tomowens3 opened this issue Mar 22, 2012 · 1 comment
Open

CVSParser.isNumber() function not performing as expected #5

tomowens3 opened this issue Mar 22, 2012 · 1 comment

Comments

@tomowens3
Copy link

isNaN returns true for "34 1/2", "34 232" and so on.

Instead of isNaN() I have changed the function to to use a Regex object as...

isNumber: function(string) {
//trim leading and trailing whitespace
//string = string.toString().replace(/^\s+/,"").replace(/\s+$/,"");
if( (string == null) || !/^-?[0-9]+[.]?[0-9]+$/.test(string) ) {
return false;
}
return true;
},

@moahmed
Copy link

moahmed commented Dec 5, 2014

That is very good, helped me out a lot and resolved the issue.

There are many other issues, which basically describe the same problem.

The zip codes / always quote values can all be resolved with this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants