Originally posted by Greg Kearney:
Are there methods that exist that will help convert word numbers into actual numbers?
Ex:
"one hundred thousand" = 100000
"two hunderd twenty five thousand three hundered fifteen" = 225315
NO! AFAIK.
You can however do this -
Write a method that would convert each digit of a number to its word (such as one, two, ..., zero) and vice versa. So you can get "one zero zero zero zero zero" for 100000, this should be fairly simple and straightforwrd.
What you say can be done, but you have to take care of many special cases, such as -
11 => eleven, 12 =>twelve (not ten one, ten two)
21 =>twenty one 22 => twenty two ...
Also,
1500 can be fifteen hundred or it can be one thousand and five hundred. I suggest you go for approach no 1 ("One zero zero...").
HTH,
- Manish
[This message has been edited by Manish Hatwalne (edited November 01, 2001).]