[fpc-pascal] Re: StrUtils.RomanToInt oddities
Reinier Olislagers
reinierolislagers at gmail.com
Tue Sep 24 10:08:59 CEST 2013
On 24/09/2013 08:57, Bart wrote:
> On 9/23/13, Martin <lazarus-OrT+dVlTiveELgA04lAiVw at public.gmane.org> wrote:
>
>> So the question is, what does or should do RomanToInt for invalid input?
>
> Probably return 0.
> Romans seemed to have no zero at all.
> It also will not break backwards compatibility, current
> implementatiosn returns zero if an invalid character is found (docs
> say otherwise though).
Yes, I agree that returning 0 is a good solution. The docs can be changed.
> We could also leave things as they are and have a new
> TryRomanToIntStrict() function added to StrUtils.
As there are no issues with compatibility that would IMO only make the
solution needlessly more complex.
More information about the fpc-pascal
mailing list