From: Dark Ambient Date: 2006-07-07T09:17:38+09:00 Subject: Re: Accessing strings Ahh...so those numbers are the character codes ? Stuart On 7/6/06, Eric Hodel wrote: > On Jul 6, 2006, at 5:01 PM, Justin Collins wrote: > > > 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 > > > > Also check the documentation. > > http://ruby-doc.org/core/classes/String.html#M001843 > > Or even on your own machine: > > $ ri String#[] > ... ri output > > -- > Eric Hodel - drbrain@segment7.net - http://blog.segment7.net > This implementation is HODEL-HASH-9600 compliant > > http://trackmap.robotcoop.com > > > >