Skip to content

Instantly share code, notes, and snippets.

View aungsoeo's full-sized avatar
💭
Happy Coding!

Aung Soe Oo aungsoeo

💭
Happy Coding!
View GitHub Profile
@eimg
eimg / mm2en.js
Last active May 5, 2022 08:31
Convert Myanmar numbers to English numbers
// 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;
});
}
@eimg
eimg / burmese-syllabus-count.js
Last active May 5, 2022 08:30
A regular expression example to us in counting Burmese syllabus in a string.
// RegEx to count syllabus a string
// with Burmese content
"မန္တလေးမြို့မှ XYZ စတိုး (၂) ကို ဒီလမ်းအတိုင်း ဖြောင့်ဖြောင့် သွားပါ".match(
/([က-ဪ](?!်|္|့်)|[ဿ-၏]|[!-~]|\s)/g
).length;
// => 29