Giter Site home page Giter Site logo

anyunit's Introduction

#AnyUnit - A powerful java unit converter

可以多级单位输入的数值单位转换工具类

Gradle dependencies

已推送到JCenter

compile 'com.github.yoojia:AnyUnit:1.2'

最基本的使用方式

    final AnyUnit anyUnit = AnyUnit.base("B");
    anyUnit.next("KB",1024)
        .next("MB")
        .next("GB")
        .next("TB")
        .next("PB");
        
    String msg = tissue.format(1023);

其它使用例子

    AnyUnit u = AnyUnit.first("元", 1);
    u.setLinkChar("-");
    u.setPrecision(3);
    u.next("万", 10000).next("千万", 1000).next("亿", 10);
    System.out.println(u.format(1));
    System.out.println(u.format(10));
    System.out.println(u.format(100));
    System.out.println(u.format(1000));
    System.out.println(u.format(10000));
    System.out.println(u.format(100000));
    System.out.println(u.format(1000000));
    System.out.println(u.format(10000000));
    System.out.println(u.format(100000000));
    System.out.println(u.format(200000000));
    System.out.println(u.format(203040000));
    System.out.println(u.format(203040500));

输入结果为:

1元
10元
100元
1000元
1万
10万
100万
1千万
1亿
2亿
2亿-304万
2亿-304万-500元

anyunit's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.