Manikandan Ram Manikandan Ram - 1 year ago 118
Javascript Question

How to convert price format string into number in jquery

I have a string like this


"$" maybe any symbol, like @,#..etc.

I want to convert this into 2099585.43

Is there any simple way to do this?

Answer Source

Use String#replace and remove characters which are not a digit or dot.

  "$2,099,585.43".replace(/[^\d.]/g, '')

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download