Want: #slice: (Re: [squeak-dev] Noob question: array slice?)

Ralph Johnson johnson at cs.uiuc.edu
Fri Aug 6 09:54:26 UTC 2010


You want one of the copy methods from SequenceableCollection.  There
are a bunch of them, and I always have to look up the exact name.  In
your case, you want copyFrom:to: as in (anArray copyFrom: 2 to: 4)
will give you a 3 element slides of anArray.   Since this is in
SequenceableCollection, it will work with strings, arrays, ordered
collections, etc.

-Ralph



More information about the Squeak-dev mailing list