[Newbies] substring

Randal L. Schwartz merlyn at stonehenge.com
Sat Oct 4 00:52:15 UTC 2008


>>>>> "Mark" == Mark Volkmann <mark at ociweb.com> writes:

Mark> I can't find a method to give me a substring of a String from a given
Mark> index to the end. The copyFrom:to: method requires telling it the end.
Mark> Does a method exist where you only specify the starting point? I know I
Mark> could write it myself, but I don't want to do that if it's already
Mark> there.

Look at all senders of #copyFrom:to: in the SequenceableCollection class.
The one you want may already be there, just named a bit odd.

In fact, there's #allButFirst: which seems to be what you want, except
that it's off by one.

That is,

   'abcde' allButFirst: 2

would return 'cde'.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


More information about the Beginners mailing list