How to get numbers to words conversion using cash_words function in indian currency format in postgres

600 views Asked by At

I am using cash_words('100'); It is showing one hundred dollars and zero cents but i want one hundred rupees as output using cash_words only For that i used lc_monetary ='en_IN.UTF-8' but no use any other parameters need to change

1

There are 1 answers

0
Java enthusiast On

Can use the below script:

SELECT replace(cash_words('100'), 'dollars and zero cents', 'rupees');

This will give the following output:

One hundred rupees

Basically, we replace the dollars and zero cents text that is appended by the cash_words function with custom text. It can also be set to blank i.e '' if you do not want anything to be appended after the converted words.