Last Updated: February 25, 2016
·
572
· zanona

parseFloats within text input

Parse any float within a text by simply calling the method:

Code:

parseFloats('This was our 10th anniversary and I have spent $812,34 on a fancy dinner at the best 7th avenue restaurant.');

Ouput:

[ 10, 812.34, 7, min: 7, max: 812.34 ]

Use the convenience attributes min and max to retrieve the high and low values from the generated array. Works great for currencies ;)

gist: parseFloats.js