Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个字符串 - “4,450.50 $”。
我只需要这个字符串中的数字。所以在这个例子中,我想找回数字 - 4450.50。
我怎么能得到它?
str = "4,450.50 $" Float str.scan(/[\d.]/).join # => 4450.5