public static class RadixUtils.NumberPattern extends Object
| Constructor and Description |
|---|
NumberPattern(String regex,
int radix,
int cutFromStart,
int cutFromEnd)
Create instance of the NumberPattern
|
| Modifier and Type | Method and Description |
|---|---|
int |
getRadix()
Get radix of this NumberPattern
|
boolean |
matches(String number)
Determines if a number represented as String matches this
NumberPattern.
|
String |
prepareNumber(String number)
Prepares the number for radix conversion.
|
public NumberPattern(String regex, int radix, int cutFromStart, int cutFromEnd)
regex - Regular expression for the number parserradix - The radix that the pattern representscutFromStart - Count of characters that will be cut from the beginning of a number
by calling prepareNumber method.cutFromEnd - Count of characters that will be cut from the end of a number by
calling prepareNumber method.public boolean matches(String number)
number - the number String representationpublic int getRadix()
public String prepareNumber(String number)
0x[0-9a-fA-F]+, representing hexadecimal number, contains some characters needed for pattern recognition, they are the first two (
0x). The numbers of left and right cut are defined in the constructor.
number - the number String representationCopyright © 2017. All rights reserved.