I need Indian currency format like 100000 as 1,00,000 , 1234 as 1,234.
I have tried this code,
function currencyFormat1(id) {
var x;
x = id.toString();
var lastThree = x.substring(x.length - 3);
var otherNumbers = x.substring(0, x.length - 3);
if (otherNumbers != '')
lastThree = ',' + lastThree;
var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree;
return res;
}
But it is working in only java script, I need this as core java code , I have tried to convert this but the
var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree;