Convert number string to formatted currency string
according to culture
function FormatStringToCurrency(val)
{
///Convert string in float number
var num = parseFloat(val);
if (isNaN(num)) {
return;
}
///Find culture of browser
var culture = navigator.language
var formatted = num.toLocaleString(culture);
var currency = num.toLocaleString(culture, { style: 'currency', currency: 'INR' });
}
No comments:
Post a Comment