Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Extract float from text string (combine all numbers), or NaN
- parseFloatAll = ( str ) ->
- num = str.toString().match(/[0-9.,]+$/g) # strip out all chars except nums, dot, commma
- if num isnt null
- num = num[ 0 ].split( ',' ).join( '' ) # remove commas
- return parseFloat( num )
- return NaN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement