# Express a number in words

**URL:** <https://techcommunity.softwareag.com/t/express-a-number-in-words/60003>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Linux\
**Created:** [June 2, 2005, 8:32pm UTC](https://techcommunity.softwareag.com/t/express-a-number-in-words/60003 "2005-06-02T20:32:24Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [June 2, 2005, 8:32pm UTC](https://techcommunity.softwareag.com/t/express-a-number-in-words/60003/1 "2005-06-02T20:32:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [June 8, 2005, 6:26pm UTC](https://techcommunity.softwareag.com/t/express-a-number-in-words/60003/2 "2005-06-08T18:26:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mick\_Fitzpatrick](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@Mick\_Fitzpatrick](https://techcommunity.softwareag.com/u/Mick_Fitzpatrick)\
**Post date:** [June 8, 2005, 10:38pm UTC](https://techcommunity.softwareag.com/t/express-a-number-in-words/60003/3 "2005-06-08T22:38:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Darrell](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Darrell](https://techcommunity.softwareag.com/u/Darrell)\
**Post date:** [June 9, 2005, 12:01am UTC](https://techcommunity.softwareag.com/t/express-a-number-in-words/60003/4 "2005-06-09T00:01:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Carlos\_Siqueira](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/carlos_siqueira/32/112_2.png) [@Carlos\_Siqueira](https://techcommunity.softwareag.com/u/Carlos_Siqueira)\
**Post date:** [June 9, 2005, 12:52am UTC](https://techcommunity.softwareag.com/t/express-a-number-in-words/60003/5 "2005-06-09T00:52:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [June 9, 2005, 1:30pm UTC](https://techcommunity.softwareag.com/t/express-a-number-in-words/60003/6 "2005-06-09T13:30:20Z")

</div>

> [@mickaxl](#):
>
> After your first post, I tried to code one that did it all but it had 2 complications.

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

> [@](#):
>
> 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.

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

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [June 9, 2005, 1:38pm UTC](https://techcommunity.softwareag.com/t/express-a-number-in-words/60003/7 "2005-06-09T13:38:38Z")

</div>

> [@Darrell](#):
>
> 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.

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 😉 )

---

<div class="post-metadata">

**Author:** ![Chofo](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/chofo/32/119_2.png) [@Chofo](https://techcommunity.softwareag.com/u/Chofo)\
**Post date:** [March 1, 2006, 11:46pm UTC](https://techcommunity.softwareag.com/t/express-a-number-in-words/60003/8 "2006-03-01T23:46:14Z")

</div>

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. 😛

If you interest, i can sendit to you.

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [March 2, 2006, 2:37pm UTC](https://techcommunity.softwareag.com/t/express-a-number-in-words/60003/9 "2006-03-02T14:37:51Z")

</div>

> [@](#):
>
> 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](http://natural.forums.softwareag.com/viewforum.php?f=45)

---

<div class="post-metadata">

**Author:** ![Chofo](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/chofo/32/119_2.png) [@Chofo](https://techcommunity.softwareag.com/u/Chofo)\
**Post date:** [March 6, 2006, 9:08pm UTC](https://techcommunity.softwareag.com/t/express-a-number-in-words/60003/10 "2006-03-06T21:08:34Z")

</div>

thanks i’ll tryit 😃

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:40pm UTC](https://techcommunity.softwareag.com/t/express-a-number-in-words/60003/11 "2021-04-02T14:40:11Z")

</div>


