public class Numbers extends Object
Helper class for processing Groovy numeric literals.
Type Params | Return Type | Name and description |
---|---|---|
|
static boolean |
isDigit(char c) Returns true if the specified character is a base-10 digit. |
|
static boolean |
isHexDigit(char c) Returns true if the specified character is a base-16 digit. |
|
static boolean |
isNumericTypeSpecifier(char c, boolean isDecimal) Returns true if the specified character is a valid type specifier for a numeric value. |
|
static boolean |
isOctalDigit(char c) Returns true if the specific character is a base-8 digit. |
|
static Number |
parseDecimal(String text) Builds a Number from the given decimal descriptor. |
|
static Number |
parseInteger(String text) Builds a Number from the given integer descriptor. |
|
static Number |
parseInteger(AST reportNode, String text) Builds a Number from the given integer descriptor. |
Returns true if the specified character is a base-10 digit.
Returns true if the specified character is a base-16 digit.
Returns true if the specified character is a valid type specifier for a numeric value.
Returns true if the specific character is a base-8 digit.
Builds a Number from the given decimal descriptor. Uses BigDecimal, unless, Double or Float is requested.
text
- literal text to parseBuilds a Number from the given integer descriptor. Creates the narrowest type possible, or a specific type, if specified.
text
- literal text to parseBuilds a Number from the given integer descriptor. Creates the narrowest type possible, or a specific type, if specified.
reportNode
- at node for error reporting in the parsertext
- literal text to parse