Module io.github.mmm.scanner
Package io.github.mmm.scanner.number
Class CharScannerNumberParserString
java.lang.Object
io.github.mmm.scanner.number.CharScannerNumberParserBase
io.github.mmm.scanner.number.CharScannerNumberParserString
- All Implemented Interfaces:
CharScannerNumberParser,CharScannerRadixHandler
-
Nested Class Summary
Nested classes/interfaces inherited from class io.github.mmm.scanner.number.CharScannerNumberParserBase
CharScannerNumberParserBase.CharScannerNumberSpecial, CharScannerNumberParserBase.CharScannerNumberSpecialDelimiter, CharScannerNumberParserBase.CharScannerNumberSpecialNonNumber -
Field Summary
Fields inherited from class io.github.mmm.scanner.number.CharScannerNumberParserBase
builder, digitsLeadingZeros, digitsTotal, digitsTrailingZeros, dotPosition, error, exponentDigitsLeadingZeros, exponentDigitsTotal, exponentSign, exponentSymbol, INFINITY, NAN, openDelimiter, radix, radixChar, sign -
Constructor Summary
ConstructorsConstructorDescriptionCharScannerNumberParserString(CharScannerRadixHandler radixMode, boolean acceptDecimal, boolean addRadix) The constructor.CharScannerNumberParserString(CharScannerRadixHandler radixMode, boolean acceptDecimal, boolean addRadix, String delimiters, boolean supportSpecials) The constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAppends the radix to the numberStringBuilder.asDouble()asFloat()asString()protected booleanMethods inherited from class io.github.mmm.scanner.number.CharScannerNumberParserBase
appendExponent, builder, digit, dot, exponent, isDigit, isValidDelimiterPosition, radix, resetTrailingZeros, sign, special, special, specials, toString
-
Constructor Details
-
CharScannerNumberParserString
public CharScannerNumberParserString(CharScannerRadixHandler radixMode, boolean acceptDecimal, boolean addRadix) The constructor.- Parameters:
radixMode- theCharScannerRadixHandlerforCharScannerNumberParserBase.radix(int, char).acceptDecimal- -trueto accept decimal numbers (BigDecimal),falseotherwise.addRadix- -trueto append the radix syntax to the numberString,falseotherwise.
-
CharScannerNumberParserString
public CharScannerNumberParserString(CharScannerRadixHandler radixMode, boolean acceptDecimal, boolean addRadix, String delimiters, boolean supportSpecials) The constructor.- Parameters:
radixMode- theCharScannerRadixHandlerforCharScannerNumberParserBase.radix(int, char).acceptDecimal- -trueto accept decimal numbers (BigDecimal),falseotherwise.addRadix- -trueto append the radix syntax to the numberString,falseotherwise.delimiters- theStringwith the accepted delimiter characters (e.g. "", "_", or "_,").supportSpecials- -trueto support special numbers like NaN or Infinity.
-
-
Method Details
-
isDecimal
protected boolean isDecimal()- Specified by:
isDecimalin classCharScannerNumberParserBase- Returns:
truein case decimal numbers withCharScannerNumberParserBase.dot()and/orexponentare accepted,falseotherwise.
-
appendRadix
protected void appendRadix()Description copied from class:CharScannerNumberParserBaseAppends the radix to the numberStringBuilder.- Overrides:
appendRadixin classCharScannerNumberParserBase
-
asBigDecimal
- Returns:
- the number as
BigDecimal.
-
asBigInteger
- Returns:
- the number as
BigInteger.
-
asDouble
- Returns:
- the number as
Doubleornullif no number was found.
-
asFloat
- Returns:
- the number as
Floatornullif no number was found.
-
asString
- Returns:
- the number as
Stringornullif no number was found.
-