Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. # Extract float from text string (combine all numbers), or NaN
  2. parseFloatAll = ( str ) ->
  3. num = str.toString().match(/[0-9.,]+$/g) # strip out all chars except nums, dot, commma
  4. if num isnt null
  5. num = num[ 0 ].split( ',' ).join( '' ) # remove commas
  6. return parseFloat( num )
  7. return NaN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement