English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

is there any function for integer validating?

2007-01-22 23:56:15 · 2 answers · asked by aryaxt 3 in Computers & Internet Programming & Design

2 answers

Yes, there are. If you just want to validate that the entered value is a number then you would use isNum(x).... For instance:

if (isNum(x)){do this....}

This returns a boolean value (t/f)

2007-01-23 00:01:03 · answer #1 · answered by Snoopy 5 · 0 0

function valNum(strToTest) {
if (strToTest == parseInt(strToTest)) {
return true;
} else {
return false;
}
}

you can also use parseFloat() if you are using decimals. i.e. "123.4567"

2007-01-23 00:01:55 · answer #2 · answered by Dashes 6 · 1 0

fedest.com, questions and answers