This is not exactly currency arithmetic problem but really just regular arithmetic issue. Is there an API which handles decimal arithmetic (compare, subtract and addition) in JavaScript? Which shall also handle locale/language-specific decimal format. Any pointers are appreciated. I am also ready to write the API, would be great if you guys has some suggestion on approach.
After quick scan, I discovered that among their many APIs, Google provide a JSON based currency converter. A request can be made from a URL such as: http://www.google.com/ig/calculator?hl=en&q=1.4GBP=?USD
And the return format will be a JSON string such as:
{lhs: "1.4 British pounds",rhs: "2.19464 U.S. dollars",error: "",icc: true}
This can be evaluated in Javascript with the eval function, or more safely, something like the
jQuery.parseJSON()
It's far from elegant, but it might help.
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