From: Gennady Bystritsky Date: 2006-02-12T14:27:09+09:00 Subject: Re: Getting last character from a string x[-1].chr [tiger-ppc.gfbm:246]bystr> irb irb(main):001:0> s = "abc" => "abc" irb(main):002:0> s[-1] => 99 irb(main):003:0> s[-1].chr => "c" irb(main):004:0> > -----Original Message----- > From: list-bounce@example.com > [mailto:list-bounce@example.com] On Behalf Of draco draco > Sent: Saturday, February 11, 2006 16:08 > To: ruby-talk ML > Subject: Getting last character from a string > > Hello > I'm new to Ruby. I've a simple question. > Is there a more readable way to get last character from > string than this one? : > > x = "text" > last_char = x[x.length-1, x.length-1] > > -- > Posted via http://www.ruby-forum.com/. > >