From: Justin Collins Date: 2006-07-07T09:01:28+09:00 Subject: Re: Accessing strings Dark Ambient wrote: > If I something like word = "ruby" > can't I do something like (I thought it was possible) > > word[0] -> r > word[1] -> u > word[2] -> b > word[3] -> y > > Trying something like that now and it's giving me "weird" numbers > > Yet I'm trying it (both program and irb) and it gives me weird numbers > > irb(main):010:0> word = "ruby" > => "ruby" > irb(main):011:0> puts word[0] > 114 > => nil > irb(main):012:0> puts word[2] > 98 > => nil > irb(main):013:0> puts word[3] > 121 > => nil > > So what am I doing wrong ? > TIA > Stuart > We _just_ discussed this: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/200453 Also check the documentation. http://ruby-doc.org/core/classes/String.html#M001843 -Justin -Justin