-
-
Save andjc/4cc29a921fd1bfa43761930b0f3592e7 to your computer and use it in GitHub Desktop.
Convert Myanmar numbers to English numbers
This file contains hidden or 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; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@andjc did you get this to work? ... also can we PM I want to ask you about Kaplan's script for detecting keyboard layouts. You seemed to have scraped his blog.