I want to change the currency format like replace comma(,) with dots and dots with comma. like
22,22,22.00 to 22.22.22,00 currently i am using javascript package name jquery-formatcurrency.js it is doing good for US format but i want another region format like europen format.
I tried to change the package code but it is not working.
$('.formatCurrency').formatCurrency();
4
Answers
You can iterate over each string, and change the one you want, like that:
To format numbers according to a specified locale use the
toLocaleString()
methodUse
Intl
API to format the currency or any other numbers.MDN Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
Sample from MDN Page:
you can use a regular expression..