Re: Number to Words Conversion - Mailing list pgsql-general

From Moiz Kothari
Subject Re: Number to Words Conversion
Date
Msg-id 82e1a9bd0711020118h25898d6cv4ffa04156149a4ac@mail.gmail.com
Whole thread Raw
In response to Re: Number to Words Conversion  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Number to Words Conversion  ("Yogesh Arora" <yogesh.arora.daffodil@gmail.com>)
List pgsql-general
Hi,

You can use what bruce has suggested and get the value you want.

eg.

select trim(substring(cash_words('1520'), 1, position('dollars' in cash_words('1520'))-1));

will return you

One thousand five hundred twenty (But ofcourse this eg. does not work for decimals)

Regards,
Moiz Kothari

On 11/2/07, Bruce Momjian < bruce@momjian.us> wrote:
yogesh wrote:
> Hello Frnds,
>
> Is there any way to Convert the Number to its equivalent String
> ( Words)
>
>  e.g. 10 to TEN. Urgent require the Answer..

We have cash_words:

        test=> SELECT cash_words('100');
                     cash_words
        ------------------------------------
         One hundred dollars and zero cents
        (1 row)

but that is money-oriented.

--
  Bruce Momjian  < bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://postgres.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings



--
Hobby Site : http://dailyhealthtips.blogspot.com

pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: getting list of tables from command line
Next
From: carter ck
Date:
Subject: Re: Improve Search