number-to-chinese-words


繁體 (useTraditional)
大寫 (useCapital)
顯示【正】 (displayPositive)
不顯示第一個【一】 (removeLeadingOne)
複合數字:全部 (useContractionAll)
複合數字:20 (useContraction20)
複合數字:30 (useContraction30)
複合數字:40 (useContraction40)
複合數字:50 (useContraction50)
複合數字:60 (useContraction60)
複合數字:70 (useContraction70)
複合數字:80 (useContraction80)
複合數字:90 (useContraction90)
複合數字:200 (useContraction200)
傳統小數 (useTraditionalFloatingUnit)

 

Visitors: []

Install

The library number-to-chinese-words can be used in 2 ways:

  1. npm
  2. cdn

Repo: https://github.com/siakhooi/ts-number-to-chinese-words/

npm

Install:
        $ npm i @siakhooi/number-to-chinese-words
      
Then in javascript file:
        const NumberToChineseWords = require('@siakhooi/number-to-chinese-words');
        console.log(NumberToChineseWords.convertNumber(7));
      

cdn (browser)

Use one of these

<script src="https://siakhooi.github.io/ts-number-to-chinese-words/number-to-chinese-words.bundle.js"></script>

<script src="https://unpkg.com/@siakhooi/number-to-chinese-words/dist/number-to-chinese-words.bundle.js"></script>

<script src="https://cdn.jsdelivr.net/npm/@siakhooi/number-to-chinese-words/dist/number-to-chinese-words.bundle.js"></script>

Example

        <HTML>
        <HEAD>
          <script src="https://siakhooi.github.io/ts-number-to-chinese-words/number-to-chinese-words.bundle.js"></script>
        </HEAD>
        <BODY>
        <div id="demo"></div>
        <script>
            document.getElementById('demo').innerHTML = '1777=' + convertNumber(1777);
          </script>
        </BODY>
      </HTML>