سؤال

I am using formatCurrency to format currency values.

For example, I am using it to format 1000 into $1.000,00 using:

$(".money").formatCurrency({ region: currencyTypeCode });

I want to perform calculations on these values now. Is there any method in formatCurrency to 'unglobalize' this number from $1.000,00 to 1000.00?

I can write my own function but I wanted to see if I am overlooking some functionality that already existed.

هل كانت مفيدة؟

المحلول

It looks like toNumber() or asNumber() will do the trick for you. I'm not familiar with the plugin so you'll have to play with it but for "$1.000,00" I'd start with:

toNumber({decimalSymbol: "," , region: currencyTypeCode });

https://code.google.com/p/jquery-formatcurrency/wiki/Usage

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top