I'm wondering if there is a java library, which can parse strings in a similar manner as date parsers. For example with the SimpleDateFormat
class it is possible to define a pattern (yyMMddHHmmssZ
) to parse a String (010704120856-0700
) for getting the date. Instead of parsing dates I would like to parse arbitary numbers.
For example I would like to be able to parse:
String: X0759502.CSV
Pattern: DSSIYYMM.CSV
X -> Data version:
'X' GOES X-ray
'M' GOES Magnetometer
'P' GOES Electrons, Protons & Alpha particles.
07 -> GOES-7, 91 = SMS-1, 92=SMS-2, etc.
3 -> 3-second values
YY -> year
MM -> month
And then for example getting a hashmap, where I can use the key word (ex. YY) to get the extracted value.