jemnotesversion 2 / featuring this entry or see all/search

Dec 10
Here’s a nice patch to the string class in Ruby to test if a string represents a valid floating-point number:
class String
  def valid_float?
    true if Float self rescue false
  end
end