This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// INPUT: ၁၁.၁၂.၂၀၁၇ | |
// OUTPUT: 11.12.2017 | |
function mm2en(num) { | |
var nums = { '၀': '0', '၁': 1, '၂': 2, '၃': 3, '၄': 4 , '၅': 5, '၆': 6, '၇':7, '၈':8, '၉':9 }; | |
return num.replace(/([၀-၉])/g, function(s, key) { | |
return nums[key] || s; | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RegEx to count syllabus a string | |
// with Burmese content | |
"မန္တလေးမြို့မှ XYZ စတိုး (၂) ကို ဒီလမ်းအတိုင်း ဖြောင့်ဖြောင့် သွားပါ".match( | |
/([က-ဪ](?!်|္|့်)|[ဿ-၏]|[!-~]|\s)/g | |
).length; | |
// => 29 |