News for hackers. Stuff that matters.
Re:Show HN: Indian Rupee formatting and word conversion for ... by aboutruby on Tuesday March 19, 2019 @06:42AM (#19429614)
# Paisa.format / Paisa.format_with_sym

This can be done with Rails's number_to_currency helper: https://apidock.com/rails/ActionView/Helpers/NumberHelper/nu...

# Paisa.words

There is number_to_human which is close: https://api.rubyonrails.org/classes/ActionView/Helpers/Numbe..., otherwise number_to_words's gem https://github.com/kslazarev/numbers_and_words

I would actually recommend using the money gem to handle money objects: https://github.com/RubyMoney/money

Re:Show HN: Indian Rupee formatting and word conversion for ... by sudhirj on Tuesday March 19, 2019 @09:36AM (#19430644)
All of the methods and libraries assume regular grouping, but India's money is grouped irregularly. While regular money is counted in groups of 10^3 (thousands, millions, billions, trillions), in India there's a 3,2,2 cycle. One lakhs = 100,000 and 1 crore is 100 lakhs, but if you had 1000 of them it would still be a thousand.

Everybody seems to get this wrong, even Google Sheets.

Re:Show HN: Indian Rupee formatting and word conversion for ... by aboutruby on Tuesday March 19, 2019 @10:06AM (#19430888)
Oh I see, sorry, didn't look closely enough at the examples. Great project! Maybe this could be upstreamed in Rails?
Re:Show HN: Indian Rupee formatting and word conversion for ... by sudhirj on Tuesday March 19, 2019 @10:57AM (#19431364)
Yeah, that would be ideal. Let me get the algos tightened up with feedback and testing, and I’ll try submitting them.
Re:Show HN: Indian Rupee formatting and word conversion for ... by marvindanig on Tuesday March 19, 2019 @09:49AM (#19430742)
Tremendous, thanks for sharing this gem!