0.0
No commit activity in last 3 years
No release in over 3 years
transform number to chinese numerals or to chinese money.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.15
>= 0
~> 10.0
 Project Readme

ChineseCapital

transform number to chinese numerals or to chinese money.

Installation

Add this line to your application's Gemfile:

  gem 'chinese_capital'

And then execute:

$ bundle

Or install it yourself as:

$ gem install chinese_capital

Usage

transform number to chinese numerals

  ChineseCapital.parse(10103)  # => 一万零一百零三

transform number to chinese money

  ChineseCapital.to_money(10103)  # => 壹万零壹佰零叁元整

with custom config

In Rails direction 'config/initializers/', create file 'chinese_capital.rb', and add code:

config/initializers/chinese_capital.rb

  ChineseCapital::Number.configure do |config|
    config.normal = {
      figure: '〇一二三四五六七八九'
    }
    config.money = {
      unit: '美元'
    }
  end
  ChineseCapital.parse(10103)  # => 一万〇一百〇三
  ChineseCapital.to_money(10103)  # => 壹万零壹佰零叁美元整

License

The gem is available as open source under the terms of the MIT License.