ruby on rails - Getting only digits out of a string -


i have string - "4,450.50 $".

i need numbers string. in example number - 4450.50 back.

how it?

str = "4,450.50 $" float str.scan(/[\d.]/).join # => 4450.5 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -