Last active
March 14, 2018 09:04
-
-
Save awolad/a733eee1f41833f11afed6a9480d7432 to your computer and use it in GitHub Desktop.
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
var total = 1102688; | |
var totalToBDformat = total.toLocaleString('bn-BD', { minimumFractionDigits: 2 }); // ১১,০২,৬৮৮.০০ | |
var numbers = { | |
'০': 0, | |
'১': 1, | |
'২': 2, | |
'৩': 3, | |
'৪': 4, | |
'৫': 5, | |
'৬': 6, | |
'৭': 7, | |
'৮': 8, | |
'৯': 9 | |
}; | |
replaceNumbers function (input) { | |
var output = []; | |
for (var i = 0; i < input.length; ++i) { | |
if (numbers.hasOwnProperty(input[i])) { | |
output.push(numbers[input[i]]); | |
} else { | |
output.push(input[i]); | |
} | |
} | |
return output.join(''); | |
} | |
replaceNumbers(totalToBDformat); // 11,02,688.00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment