Hi -- On Sat, 27 Jun 2009, Peter Wu wrote: > s = "1234" [0..1] > p s #> "12" > p s.to_i #> 12 > s = s[1] > p s #> 50 > p s.to_i #> 50 > > I can see the reason for this happening, but I don't want it to happen. > > So how do I make it return 2 instead of 50? Addendum to other answers: In 1.9 it returns the character rather than the character code. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now available: The Well-Grounded Rubyist (http://manning.com/black2) "Ruby 1.9: What You Need To Know" Envycasts with David A. Black http://www.envycasts.com