Welcome to the Monastery | |
PerlMonks |
Spelled out numbers to numerical equivalent functionby Akira71 (Scribe) |
on Apr 12, 2005 at 15:39 UTC ( [id://447053]=perlquestion: print w/replies, xml ) | Need Help?? |
Akira71 has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks, Once again I must graciously throw myself upon your collective wisdom for a solution to a problem. I am looking for a function or perhaps a regex that can take a spelled out number like 'first' and then convert it to '1st'. Initally this would seem to be easy but then interesting possibilities creep up. Many years ago in my lost C porgramming days I had an algorithm for just this tpye of thing, but now I can find no reference to it nor find something similar online. The reason for my frustration is a billing company I am interfacing with requires the addresses to replace spelled out numbers to numerical equivalents. Numbers after 10 rarely show up, but a quick check in our database reveals people entering addresses like: 12308 Thirteenth Street The answer should then be 12308 13th Street. If anyone knows of such an algorithm in perl I would appreciate it. Sincerely, Akira the most humble in this regards.
Back to
Seekers of Perl Wisdom
|
|