public class DecimalFormatNumberMatcher extends Object implements NumberMatcher
NumberMatcher that uses a standard Java DecimalFormat to
match numbers.
By default, this uses the default DecimalFormat with the platform default Locale.
You will probably want your DecimalFormat to have grouping turned off, otherwise
something like 1,2 (in UK locale) would be parsed as a number 12.
| Constructor and Description |
|---|
DecimalFormatNumberMatcher() |
DecimalFormatNumberMatcher(DecimalFormat decimalFormat) |
DecimalFormatNumberMatcher(Locale locale) |
| Modifier and Type | Method and Description |
|---|---|
DecimalFormat |
getDecimalFormat() |
int |
getNumberEnd(InputContext input,
int startIndex)
Implementations should analyse the given
InputContext starting at the given
index to see if it looks like an (unsigned) number. |
void |
setDecimalFormat(DecimalFormat decimalFormat) |
public DecimalFormatNumberMatcher()
public DecimalFormatNumberMatcher(Locale locale)
public DecimalFormatNumberMatcher(DecimalFormat decimalFormat)
public DecimalFormat getDecimalFormat()
public void setDecimalFormat(DecimalFormat decimalFormat)
public int getNumberEnd(InputContext input, int startIndex)
NumberMatcherInputContext starting at the given
index to see if it looks like an (unsigned) number. If it is a number, return the
index of the next non-number character. Otherwise, return -1.getNumberEnd in interface NumberMatcherCopyright © 2008–2026 The University of Edinburgh. All rights reserved.