I have a string, say \'123\', and I want to convert it to the integer 123.
\'123\'
123
I know you can simply do some_string.to_i, but that
some_string.to_i
Another unexpected behavior with the accepted solution (with 1.8, 1.9 is ok):
>> Integer(:foobar) => 26017 >> Integer(:yikes) => 26025
so if you're not sure what is being passed in, make sure you add a .to_s.
.to_s