Coder Social home page Coder Social logo

vnnum2words's Introduction

VNnum2words.js

Vietnamese convert number to words by js(chuyển số thành chữ trong tiếng việt bằng ngôn ngũ javascript)

installation

In a browser(trong trình duyệt):

normal script(dùng javascript thông thường):
<script src="https://cdn.jsdelivr.net/gh/linhpn96/VNnum2words/src/index.js">

module script( dùng cho module):
<script type="module">
    import {default as VNnum2words} from 'https://cdn.jsdelivr.net/gh/linhpn96/VNnum2words/src/index.mjs';
</script>

Using npm:

$ npm i -g npm
$ npm i vn-num2words

Note: add --save if you are using npm < 5.0.0

In Node.js(trong nodejs):

//js
const VNnum2words = require('vn-num2words');
console.log(VNnum2words(10000));
//es module
import {default as VNnum2words} from 'vn-num2words';
console.log(VNnum2words(10000));

In es6 babel

import VNnum2words from 'vn-num2words';
console.log(VNnum2words(10000));

warning

in javascript the number type is corrected true is less than 9007199254740991 so if number greater than 9007199254740991 must use string, or you can use string for all case trong javascript định dạng số bị giới hạn ở 9007199254740991 nên nếu số lớn hơn 9007199254740991 mời dùng kiểu chuỗi, hoặc là dùng toàn bộ là string

example

less than 9007199254740991:
VNnum2words(1000001);
greater than 9007199254740991:
VNnum2words('1234567899876543210101'));
or use tring all case
VNnum2words('100'));


0 không
1 một
10 mười
14 muời bốn
100 một trăm
101 một trăm linh một
125 một trăm hai mươi lăm
1000 một nghìn
100000 một trăm nghìn
1000001 một triệu không nghìn không trăm linh một
1000000000000000001 một tỷ tỷ không trăm linh một
123450000000000001 một trăm hai mươi ba triệu bốn trăm năm mươi nghìn tỷ không trăm linh một
123450000001 một trăm hai mươi ba tỷ bốn trăm năm mươi triệu không nghìn không trăm linh một
1234567899876543210101 một nghìn hai trăm ba mươi tư tỷ  tỷ năm trăm sáu mươi bẩy triệu tám trăm chín mươi chín nghìn tám trăm bẩy mươi sáu tỷ năm trăm bốn mươi ba triệu hai trăm mười nghìn một trăm linh một


vnnum2words's People

Contributors

linhpn96 avatar

Stargazers

VinhDang avatar  avatar Trần Đại Hiệp avatar Nguyễn Kim Sơn avatar

Watchers

 avatar

vnnum2words's Issues

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.