How to convert currency string to floating point number using Javascript
P粉593118425
2023-08-23 22:49:40
<p>I have a textbox that will have a <em>currency</em> string in it and I need to convert that string to a double precision float to perform some operations. </p>
<p><code>"$1,100.00"</code> → <code>1100.00</code></p>
<p>This needs to be done on the client side. I have no choice but to keep the <em>Currency</em> string as input, but need to cast it to a double precision float for some math operations. </p>
accounting.js is a good choice. I'm using it on a project and had a very good experience using it.
You can find it on GitHub.
Remove all non-decimal points/digits: