I am currently trying to deal with numbers for both English (en) and German (de) languages. I have a global function which does this and works fine until the number reaches 1000 or more.
function getLocaleString(floatValue) {
var CurrentCulture = $('#CurrentCulture').val();
if (CurrentCulture != "" && CurrentCulture != null) {
return floatValue.toLocaleString(CurrentCulture, { minimumFractionDigits: 2,
maximumFractionDigits: 2 });
}
return floatValue;
}
Is there a way to get this to remove the comma so the figures do not become distorted?
You could set the useGrouping option to false.
floatValue.toLocaleString(CurrentCulture, { minimumFractionDigits: 2,
maximumFractionDigits: 2, useGrouping: false });
This should avoid the comma for thousand grouping in english and the dot for thousand grouping in german locale.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With