Parse coordinates from a string with the column padded with zeros
simbig opened this issue · 1 comments
**Does your feature request relate to a problem? Please describe it.
I have a *.csv file and would like to verify that the well coordinate is a valid coordinate in, for example, a CoordinateSystem96Well
by creating a Coordinate
class.
Unfortunately, in the raw data, the column of the coordinate is padded with a zero when the column is 1-9:
Describe the desired solution
Thus, a method is needed to parse also these coordinate strings into a coordinate
class
Describe the alternatives you have considered.
- new method
Coordnate::fromPaddedString()
- add a parameter to the existing
Coordnate::fromString()
method to declare that the column is padded - Adding "magic logic" to the
Coordnate::fromString()
method, which can parse both padded and non-padded columns without requiring a parameter.
Given columns are int
and 1 === 01
(see https://3v4l.org/eQPde), I would not mind a more flexible parser that ignores leading 0 in numbers. This also solves the use case where you don't know the format exactly because the input is external or messy.
A possible downside of flexible parsers is the introduction of ambiguity, I don't see that issue here. If we want to be as accurate as possible, we could specify that we are doing greedy parsing, in this case matching a row name first.