github.com/stereosteve/crystal-si
master / published Apr 19, 2017 / repository
Parse + format SI numbers
SI
Formats + Parses SI prefix numbers
Installation
Add this to your application's shard.yml:
dependencies:
SI:
github: stereosteve/SI
Usage
require "SI"
SI.format(1.21e9, "W") # => "1.21 GW"
SI.parse("1.21 GW") # => {1.21e9, "W"}