stdlib/string/to_i.rb

tests/_examples/stdlib/string/to_i.rb in the metorex repository.

puts("42".to_i)
puts("  99  ".to_i)
puts("hello".to_i)
puts("-7".to_i)
puts("3abc".to_i)
puts("3.14".to_f)
puts("hello".to_f)

s = "world"
d = s.dup
puts(d)

puts("hello".gsub("l", "r"))
puts("hello".sub("l", "r"))
puts("".empty?)
puts("hi".empty?)

Output:

42
99
0
-7
3
3.14
0.0
world
herro
herlo
true
false