I want to extract decimal number 265.12 or 0.0 from alphanumeric string (say amount) having value $265.12+ or $265.12- or $0.0+ or $0.0- and use it apply struts logic tag in JSP. Not sure how to extract number maybe with help of JavaScript.
You can use regex like this,
Live Demo
var amount = "$265.12+";
var doublenumber = Number(amount.replace(/[^0-9\.]+/g,""));
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