Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,9 @@
def is_numeric?(s)
begin
Float(s)
rescue
false # not numeric
else
true # numeric
end
end

View file

@ -0,0 +1,3 @@
def is_numeric?(s)
!!Float(s) rescue false
end

View file

@ -0,0 +1,3 @@
def is_numeric?(s)
!!Float(s, exception: false)
end

View file

@ -0,0 +1,4 @@
strings = %w(0 0.0 -123 abc 0x10 0xABC 123a -123e3 0.1E-5 50e)
strings.each do |str|
puts "%9p => %s" % [str, is_numeric?(str)]
end