Skip to content

Instantly share code, notes, and snippets.

@jittuu
Created August 9, 2020 11:25
Show Gist options
  • Save jittuu/70f6ebf335a3322fdbbf4ef035bf50f9 to your computer and use it in GitHub Desktop.
Save jittuu/70f6ebf335a3322fdbbf4ef035bf50f9 to your computer and use it in GitHub Desktop.
convert to Myanmar Number string
const _mmNumbers = {
'0': '၀',
'1': '၁',
'2': '၂',
'3': '၃',
'4': '၄',
'5': '၅',
'6': '၆',
'7': '၇',
'8': '၈',
'9': '၉'
};
const mmNumber = (n: number | string) => {
const nstr = typeof n === "number" ? n.toString() : n;
let out = '';
for (var i = 0; i < nstr.length; i++) {
var c = nstr.charAt(i);
out += _mmNumbers[c];
}
return out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment