converting words to numbers wanted code

i want a program to convert words to numbers for example
Input:
one hundred twenty three
thirty four thousand one hundred eight
eleven

Output:
123
34108
11

can anyone help me plz?
Maybe create some logic to do something like this for each word:

start with 0
one - add 1
hundred - multiply by 100
twenty - add 20
three - add 3

I guess you'll have to put aside values after encountering a multiply-by step. Consider the 34108 case, for one and then hundred you'd have to keep 1 separate from the 34,000 and total them when you're done.

Good luck!
thx very much i will try
Topic archived. No new replies allowed.