jsUtils.isFloat()
Checks if the variable is a float number.
jsUtils.isFloat( str )
str - any javascript variable
Returns true if the variable is a valid float number or false otherwise.
Any input variable is treated as a string. The function will test each charector in this string to be inside the set of 0..9 and one dot
charector. It cannot start nor end with a dot. If all charectors are inside the set, it will return true, otherwise false.
Example
<!DOCTYPE html>
<html>
<head>
<script src="system/libs/jsUtils.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload = function() {
alert(jsUtils.isFloat('10'));
alert(jsUtils.isFloat('10.2'));
}
</script>
<body>
</body>
</html>
See Also