You pick a starting point to slice and then a number of items to
slice. For example, if you write:

"0123456789".slice(i, size)

then you will slice starting after the `i`-th character, and for
`size` more characters, or until the end of the sequence, whichever
comes first. For example,

"0123456789".slice(5, 3)

will yield "567". We start at "5" because the i = 5th character is
"4", and "5" is right after that. Then we take size = 3 characters in
all, yielding "567".

By contrast, if you wrote,

"abcdefgh".slice(5, 10)

you will get "fgh", because we can't take any more characters after
"h" from the sequence.

~ jf
--
John Feminella
Principal Consultant, BitsBuilder
LI: http://www.linkedin.com/in/johnxf
SO: http://stackoverflow.com/users/75170/



On Tue, Feb 15, 2011 at 12:15, Gaba Luschi <friedoysterlover / gmail.com> wrote:
> Thanks - I'm still a little bit confused. Where does the slice
> begin/stop slicing?
>
> --
> Posted via http://www.ruby-forum.com/.
>
>