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
Written by Marcus Zanona
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Parse
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#