Hi, RudiC.
Quote:
Excellent! One question: Wouldn't "Twenty-second" require a trailing ordinal point / dot?
If I were doing the code, I think I'd add an option for suffixes, e.g. twenty-second -> 22nd for ordinals.
This code is available in repositories, as well as at
Lingua::EN::Words2Nums - convert English text to numbers - metacpan.org . It seems to be about 10 years old, but may be amenable to updates. I also didn't dig very deeply -- this seemed to work -- but there may be other modules, perl, python, etc., that can do the same.
A brief look at the module seems like much of the work is table-driven, so it may be just a bit of work to add another table to optionally add suffixes.
There are always things of interest that come up in searches at the repo at cpan.org.
Best wishes ... cheers, drl