Created
August 9, 2020 11:25
-
-
Save jittuu/70f6ebf335a3322fdbbf4ef035bf50f9 to your computer and use it in GitHub Desktop.
convert to Myanmar Number string
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
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