public final class NumberOf extends Number implements Scalar<Number>
Number
.
long value = new NumberOf("186789235425346").longValue(); int value = new NumberOf("1867892354").intValue(); double value = new NumberOf("185.65156465123").doubleValue();
There is no thread-safety guarantee.
This class implements Scalar
, which throws a checked
Exception
. This may not be convenient in many cases. To make
it more convenient and get rid of the checked exception you can
use the UncheckedScalar
decorator. Or you may use
IoCheckedScalar
to wrap it in an IOException.
Constructor and Description |
---|
NumberOf(String txt)
Ctor.
|
NumberOf(Text text)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
double |
doubleValue() |
float |
floatValue() |
int |
intValue() |
long |
longValue() |
Number |
value()
Convert it to the value.
|
byteValue, shortValue
public NumberOf(String txt)
txt
- Number-stringpublic NumberOf(Text text)
text
- Number-textpublic float floatValue()
floatValue
in class Number
public double doubleValue()
doubleValue
in class Number
Copyright © 2017–2019 Cactoos. All rights reserved.