recently, found another kind of digital to Chinese, capitalization, the amount of the method, I think it will be more appropriate than the previous found :NPM installation package address: Https://npm.taobao.org/package/nzh (here, There will be more detailed use of the introduction. And I just measured one of them ... )
Introduction: Nzh is suitable for the development process needs to convert the number to the Chinese scene in the form of a string conversion, solve the problem of large numbers and floating point number, please self-rounding the original data and other operations.
1. First install the dependency package in the project:npm install nzh
2. In fact, this is their own at the time of a small test, using Nzh, after the installation of the dependency package, they will nzh.js file directly into the page,
<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title>Title</title> <Scripttype= "Text/javascript"src= "Js/jquery-1.11.3.js"></Script> <Scripttype= "Text/javascript"src= "Js/nzh.js"></Script></Head><Body><Divstyle= "margin:100px 200px;"> <P>Enter Amount</P> <inputtype= "text"ID= "Low"></BR> <inputtype= "button"value= "Converted to uppercase amount"ID= "BTN"onclick= "trans ()"/> <DivID= "All"></Div></Div><Scripttype= "Text/javascript">JQuery (function() {JQuery ("#btn"). Click (function () { vartext=JQuery ("#low"). Val (); varNZHCN=nzh.cn; JQuery ("#all"). HTML (Nzhcn.tomoney (text)); }); });</Script></Body></HTML>
The effect is:
3. I think the method will be better than the previous two methods, but it depends on the specific situation, choose which one to use.
Number to Chinese, uppercase, amount