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
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
Post a Comment