Skip to content
/ numeja Public

Parse numbers in japanese numerals from String 漢数字とかをInteger or Floatに変換するRuby Gem

License

Notifications You must be signed in to change notification settings

rike422/numeja

Repository files navigation

Numeja Gem Version Build Status Code Climate Coverage Status

Parse numbers in japanese numerals from String

漢数字とかをInteger or Floatに変換するGem

Installation

Add this line to your application's Gemfile:

gem 'numeja'

And then execute:

$ bundle

Or install it yourself as:

$ gem install numeja

Usage

require 'numeja'

Numeja.numerize('二千三百八十一億九千四百八十七万六千三百十一') # =>  238_194_876_311
Numeja.numerize('弐阡參佰捌拾壱億九千四百八十七万六千三百十一') # =>  238_194_876_311
Numeja.numerize('9876億5432万1千2百3十4') # => 987_654_321_234)
Numeja.numerize('9876億5432万1千2百3十4') # => 987_654_321_234
Numeja.numerize('玖阡捌陌漆拾陸億伍仟肆佰參十貳万壹千弐百卅4') # => 987_654_321_234
Numeja.numerize('505') #  => 505
Numeja.numerize('九八七六五四三二一零') # => 9_876_543_210
Numeja.numerize('九分八厘七毛六糸五忽四微三繊二沙零塵一埃') # => 0.9876543201
Numeja.numerize('九割八分七厘六毛五糸四忽三微二繊零沙一塵') # => 0.9876543201
Numeja.numerize('二分の一') # => 0.5
Numeja.numerize('三分の一') # => 0.33333333333...

About

Parse numbers in japanese numerals from String 漢数字とかをInteger or Floatに変換するRuby Gem

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages