A Ruby library for converting between positive integers and Sino-Japanese numbers or text.
require 'bangou'
89.to_j
# => "八十九"
289.to_jtext
# => "二百八十九"
Bangou.integer_to_japanese_numerals(2305)
# => "二千三百五"
Bangou.integer_to_japanese_text(2305)
# => "にせんさんびゃくご"
gem install bangou
番号 uses bacon for testing, runnable using rake spec
.
Pull requests with tests accepted!
Only works on numbers between 0 and 99,999,999 (otherwise throwing an OutOfRangeException).