I can't find a method to give me a substring of a String from a given index to the end. The copyFrom:to: method requires telling it the end. Does a method exist where you only specify the starting point? I know I could write it myself, but I don't want to do that if it's already there.
--- Mark Volkmann
"Mark" == Mark Volkmann mark@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'.
What's wrong with last: ?
'abcdefg' last: 4
yields 'defg'
There's also first:
On Oct 3, 2008, at 5:52 PM, Randal L. Schwartz wrote:
"Mark" == Mark Volkmann mark@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@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 _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
beginners@lists.squeakfoundation.org