Git Product home page Git Product logo

rmb-capital-js's Introduction

Convert RMB amount to Chinese uppercase.


NPM version


将阿拉伯金额数字转换为汉字大写形式。


使用

npm i rmb-capital
import { rmbCapital } from "rmb-capital";

console.log(rmbCapital(123456789.01));
// 人民币壹亿贰仟叁佰肆拾伍万陆仟柒佰捌拾玖元零壹分

在转换前一定确保数字的正确性。最大金额到万亿级。

在浏览器

<script src="./dist/rmb-capital.min.js"></script>
<script>
console.log(rmbCapital(123456789.01));
</script>

规范

详查 《会计基础工作规范》,此处总结性的罗列关键点。

  • 所有以元为单位
  • 汉字大写数字金额如:零、壹、贰、叁、肆、伍、陆、柒、捌、玖、拾、佰、仟、万、亿等
  • 大写金额数字到元或者角为止的,在“元”或者“角”字之后应当写“整”字或者“正”字(本项目使用“整”),大写金额数字有分的,分字后面不写“整”或者“正”字
  • 大写金额数字前未印有货币名称的,应当加填货币名称,即“人民币”,货币名称与金额数字之间不得留有空白
  • 阿拉伯金额数字中间有“0”时,汉字大写金额要写“零”字
  • 阿拉伯数字金额中间连续有几个“0”时,汉字大写金额中可以只写一个“零”字; 阿拉伯金额数字元位是“0”,或者数字中间连续有几个“0”、元位也是“0”但角位不是 “0”时,汉字大写金额可以只写一个“零”字,也可以不写“零”字

其它版本

License

The MIT License (MIT). Please see License File for more information.

rmb-capital-js's People

Contributors

chuoke avatar

Watchers

 avatar

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.