| java.lang.Object org.codehaus.groovy.syntax.Numbers
Numbers | public class Numbers (Code) | | Helper class for processing Groovy numeric literals.
author: Brian Larson author: Chris Poirier version: $Id: Numbers.java 1036 2004-04-07 20:19:21Z cpoirier $ |
Method Summary | |
public static boolean | isDigit(char c) Returns true if the specified character is a base-10 digit. | public static boolean | isHexDigit(char c) Returns true if the specified character is a base-16 digit. | public static boolean | isNumericTypeSpecifier(char c, boolean isDecimal) Returns true if the specified character is a valid type specifier
for a numeric value. | public static boolean | isOctalDigit(char c) Returns true if the specific character is a base-8 digit. | public static Number | parseDecimal(String text) Builds a Number from the given decimal descriptor. | public static Number | parseInteger(String text) Builds a Number from the given integer descriptor. |
isDigit | public static boolean isDigit(char c)(Code) | | Returns true if the specified character is a base-10 digit.
|
isHexDigit | public static boolean isHexDigit(char c)(Code) | | Returns true if the specified character is a base-16 digit.
|
isNumericTypeSpecifier | public static boolean isNumericTypeSpecifier(char c, boolean isDecimal)(Code) | | Returns true if the specified character is a valid type specifier
for a numeric value.
|
isOctalDigit | public static boolean isOctalDigit(char c)(Code) | | Returns true if the specific character is a base-8 digit.
|
parseDecimal | public static Number parseDecimal(String text)(Code) | | Builds a Number from the given decimal descriptor. Uses BigDecimal,
unless, Double or Float is requested.
Parameters: text - literal text to parse instantiated Number object throws: NumberFormatException - if the number does not fit within the typerequested by the type specifier suffix (invalid numbers don't makeit here) |
parseInteger | public static Number parseInteger(String text)(Code) | | Builds a Number from the given integer descriptor. Creates the narrowest
type possible, or a specific type, if specified.
Parameters: text - literal text to parse instantiated Number object throws: NumberFormatException - if the number does not fit within the typerequested by the type specifier suffix (invalid numbers don't makeit here) |
|
|