myanmar-num-to-word

0.0.5 • Public • Published

Myanmar-Num-to-Word

Myanmar-Num-to-Word is simple Javascript module to convert Myanmar numbers digits to words plus burmese numbers to english numbers conversion.

Available to test on Demo.

Examples

Numbers to Words

1 => တစ်
12 => တစ်ဆယ့်နှစ်
123 => တစ်ရာ နှစ်ဆယ့်သုံး
1234 => တစ်ထောင် နှစ်ရာ သုံးဆယ့်လေး
12345 => တစ်သောင်း နှစ်ထောင် သုံးရာ လေးဆယ့်ငါး
123456 => တစ်သိန်း နှင့် နှစ်သောင်း သုံးထောင် လေးရာ ငါးဆယ့်ခြောက်
1234567 => တစ်ဆယ့်နှစ်သိန်း နှင့် သုံးသောင်း လေးထောင် ငါးရာ ခြောက်ဆယ့်ခုနှစ်
12345678 => သိန်းတစ်ရာ နှစ်ဆယ့်သုံးသိန်း နှင့် လေးသောင်း ငါးထောင် ခြောက်ရာ ခုနှစ်ဆယ့်ရှစ်
123456789 => သိန်းတစ်ထောင် နှစ်ရာ သုံးဆယ့်လေးသိန်း နှင့် ငါးသောင်း ခြောက်ထောင် ခုနှစ်ရာ ရှစ်ဆယ့်ကိုး
1234567890 => သိန်းတစ်သောင်း နှစ်ထောင် သုံးရာ လေးဆယ့်ငါးသိန်း နှင့် ခြောက်သောင်း ခုနှစ်ထောင် ရှစ်ရာ ကိုးဆယ်

Burmese to English and Vice Versa

0123456789 => ၀၁၂၃၄၅၆၇၈၉
၀၁၂၃၄၅၆၇၈၉ => 0123456789

Features

  • Digits to Words
  • Burmese Numbers <=> English Numbers conversion

For Digits to Words conversion, the library provides 2 modes - Written and Speech. In Speech mode, pronunciation rule shifts numerical place name (the tens, hundreds and thousands place) from the low tone to the creaky tone.

Written Mode (Default) => တစ်ထောင် နှစ်ရာ သုံးဆယ့်လေး
Speech Mode => တစ်ထောင့် နှစ်ရာ့ သုံးဆယ့်လေး

Digits to Words can accept both burmese and english numbers input.

Installation

Install using npm:
npm install myanmar-num-to-word --save  
In the browser

You can simply include the CDN link, kindly provided by unpkg.

<script src="https://unpkg.com/myanmar-num-to-word@latest"></script>  

Usages

In browser

<script src="myanmarNumToWord.js"></script> 
<script>    
  console.log(myanmarNumToWord.convertToBurmeseWords(12345)); // တစ်သောင်း နှစ်ထောင် သုံးရာ လေးဆယ့်ငါး
  console.log(myanmarNumToWord.convertToBurmeseWords(12345, 'speech')); // တစ်သောင်း နှစ်ထောင့် သုံးရာ့ လေးဆယ့်ငါး
  console.log(myanmarNumToWord.convertToEnglishNumber('၁၂၃၄၅')); // 12345
  console.log(myanmarNumToWord.convertToBurmeseNumber(12345)); // ၁၂၃၄၅  
</script>  

In Node

const myanmarNumToWord = require('myanmar-num-to-word');  
myanmarNumToWord.convertToBurmeseWords(12345); // တစ်သောင်း နှစ်ထောင် သုံးရာ လေးဆယ့်ငါး  
myanmarNumToWord.convertToBurmeseWords(12345, 'speech'); // တစ်သောင်း နှစ်ထောင့် သုံးရာ့ လေးဆယ့်ငါး
myanmarNumToWord.convertToEnglishNumber('၁၂၃၄၅'); // 12345  
myanmarNumToWord.convertToBurmeseNumber(12345); // ၁၂၃၄၅  

Credit for Numerical Knowledge

License MIT

Package Sidebar

Install

npm i myanmar-num-to-word

Weekly Downloads

98

Version

0.0.5

License

MIT

Unpacked Size

30.5 kB

Total Files

7

Last publish

Collaborators

  • stevenay