Express a number in words

Hello all!

My problem: I have to express numbers on an invoice in words.
Examples:

122 --> ONEHUNDRETTWENTYTWO
51 --> FIFTYONE

Next problem: I have to do it in German and in Portuguese.
Are there any standard NATURAL-routines to solve my problems?

Thanks,

Matthias

It seems, that I have to do it manually. The easiest way is to convert the number digit by digit:

1024 --> ONE-ZERO-TWO-FOUR

After your first post, I tried to code one that did it all but it had 2 complications. The first was knowing how big your number was going to be and how many decimals it had. The utility would be useless onless it could cater for anysize number. The second is catering for things like this where 1 is ONE, 21 is TWENTY ONE, but 11 is ELEVEN. I did find that it was do-able especially if you deal with your number in a look from right to left. Then 1024 could easily be expressed as ONE THOUSAND TWENTY FOUR.

I have a routine that was written by a co-worker here many years ago that does this (in English only), if you are interested.

One of the oldesr routines available most of the times in COBOL.
In Brazil(Portuguese) we call ROTINA DE EXTENSO and has been used initially to write checks and later for other applications.

Oh, please don’t bother. My first question was, if there is any standard-Natural-Module available.

I guess the biggest number to deal with is N8.2 …

Yes, I’m interested! If you prefer E-Mail, just send it to

matthias dot lingnau at apollo minus optik dot com

(That’s how to express an e-mail-address in words :wink: )

Mattias, if you are interested, i have a routine in natural, that makes this, but is very simple and usefull, and i think its fine for you, because this routine uses arrays, then you can create an array for every language. :stuck_out_tongue:

If you interest, i can sendit to you.

Thanks for answering. Meanwhile I changed the company. So my posting is no longer up-to-date.

But maybe it’s useful to post you code in the new “Natural Open Source Forum”
http://natural.forums.softwareag.com/viewforum.php?f=45

thanks i’ll tryit :smiley: