| @@ 134-143 (lines=10) @@ | ||
| 131 | * @return \AppserverIo\Lang\Flt A <code>Float</code> object holding the value represented by the <code>Strg</code> argument |
|
| 132 | * @exception \AppserverIo\Lang\NumberFormatException If the string does not contain a parsable number |
|
| 133 | */ |
|
| 134 | public static function valueOf(Strg $string) |
|
| 135 | { |
|
| 136 | if (! preg_match("/([0-9\.-]+)/", $string->stringValue())) { |
|
| 137 | NumberFormatException::forInputStrg($string->stringValue()); |
|
| 138 | } |
|
| 139 | if (! is_numeric($string->stringValue())) { |
|
| 140 | NumberFormatException::forInputStrg($string->stringValue()); |
|
| 141 | } |
|
| 142 | return new Flt((float) $string->stringValue()); |
|
| 143 | } |
|
| 144 | ||
| 145 | /** |
|
| 146 | * Returns a new <code>float</code> initialized to the value |
|
| @@ 136-145 (lines=10) @@ | ||
| 133 | * @return \AppserverIo\Lang\Integer A <code>Integer</code> object holding the value represented by the <code>Strg</code> argument |
|
| 134 | * @exception \AppserverIo\Lang\NumberFormatException If the string does not contain a parsable number |
|
| 135 | */ |
|
| 136 | public static function valueOf(Strg $string) |
|
| 137 | { |
|
| 138 | if (! preg_match("/([0-9-]+)/", $string->stringValue())) { |
|
| 139 | NumberFormatException::forInputStrg($string->stringValue()); |
|
| 140 | } |
|
| 141 | if (! is_numeric($string->stringValue())) { |
|
| 142 | NumberFormatException::forInputStrg($string->stringValue()); |
|
| 143 | } |
|
| 144 | return new Integer((integer) $string->stringValue()); |
|
| 145 | } |
|
| 146 | ||
| 147 | /** |
|
| 148 | * Returns a new <code>Integer</code> initialized to the value |
|