From: Ian Whitlock Date: 2007-07-18T07:05:51+09:00 Subject: Re: type conversion Shandy Nantz wrote: > So there is an to_s for strings and a to_i for integers. However, if I > have an array of integers and I want to grab one, I get back and ASCII > character. For example, when I grab a 1 from the array it returns a 49 - > but I wanted the one! How do I convert it back to its integer > want-to-be? Thanks, > > ~S > > P.S. I imagine this is probably an easy solution but, I am a ruby > newbie. Shandy, Perhaps this helps. Note the difference between 004 and 006 irb(main):003:0> i = "1234" => "1234" irb(main):004:0> i[0] => 49 irb(main):005:0> i[0].class => Fixnum irb(main):006:0> i[0,1] => "1" irb(main):007:0> i[0,1].class => String irb(main):008:0> i[0,1].to_i => 1 irb(main):009:0> i[0,1].to_i.class => Fixnum Good luck from another newbie. Ian -- Posted via http://www.ruby-forum.com/.