Skip to content

Instantly share code, notes, and snippets.

@andjc
Forked from eimg/mm2en.js
Created March 12, 2018 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andjc/4cc29a921fd1bfa43761930b0f3592e7 to your computer and use it in GitHub Desktop.
Save andjc/4cc29a921fd1bfa43761930b0f3592e7 to your computer and use it in GitHub Desktop.
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;
});
}
@HughP
Copy link

HughP commented Jun 2, 2018

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment