From: Abder-Rahman Ali Date: 2010-07-14T07:09:35+09:00 Subject: Re: What does this do? Josh Cheek wrote: > On Tue, Jul 13, 2010 at 4:26 PM, Abder-Rahman Ali < > abder.rahman.ali@gmail.com> wrote: > >> >> Thanks. >> -- >> Posted via http://www.ruby-forum.com/. >> >> > I'm not really sure what you're asking, but I think that it is probably > answered by the docs: > > > > http://ruby-doc.org/core/classes/String.html#M000771 > > str[range] => new str or nil > > If given a > range, > a substring containing characters at offsets given by the range is > returned. > In all three cases, if an offset is negative, it is counted from the end > of > *str*. Thanks Josh. For example, this from the documentation: a = "hello there" a[-3,2] #=> "er" -3 ---> Start counting from 0 to 3 from the end (Right -> Left) In this case I reached the letter "h" of there 2 ---> What should I do here? Thanks. -- Posted via http://www.ruby-forum.com/.