com.oopreserch.web
Class IsDouble
java.lang.Object
|
+--com.oopreserch.web.IsDouble
- All Implemented Interfaces:
- FormValueVerifier
- public class IsDouble
- extends java.lang.Object
- implements FormValueVerifier
Implementation of FormValueVerifier interface.
Returns true if valid as positive double.
This class sees if the given String can be parsed
to double or not.
But, even if it can be parsed to double, the String
which starts with 0 (zero) will be treated as
invalid, unless it starts with 0. (zero
followed by period).
And the String which ends with . (period) will be treated
as invalid, even if it can be parsed to double.
In addition, while the String which starts with . (period)
can be parsed to double, it will also be treated as
invalid. For example:
| String | Result |
| 10 | true |
| 010 | false |
| 0 | true |
| 0.1 | true |
| .1 | false |
| 0. | false |
| 1.0 | true |
| 1. | false |
Please note that all the Strings listed in the above table
can be parsed to double.
But, the valid String should look well also for human
beings.
- Author:
- Jun Inamori
|
Method Summary |
boolean |
isValidString(java.lang.String str)
Returns true if the given String is valid as positive
double. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IsDouble
public IsDouble()
isValidString
public boolean isValidString(java.lang.String str)
- Returns true if the given String is valid as positive
double.
- Specified by:
isValidString in interface FormValueVerifier
- Parameters:
str - String to be tested.
- Returns:
- true if the given String is valid as positive
double.
ALL CONTENTS COPYRIGHT 2002, Jun Inamori. All rights reserved.
Any questions and comments are welcome to Jun Inamori.