[Newbies] substring

Todd Blanchard tblanchard at mac.com
Tue Oct 7 02:39:04 UTC 2008


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 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
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners



More information about the Beginners mailing list