help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Easiest way to add new methods to kernel classes (f


From: Rick Flower
Subject: Re: [Help-smalltalk] Easiest way to add new methods to kernel classes (from within a script)?
Date: Fri, 26 Feb 2010 10:57:45 -0800

Thanks!  I'll give it a try!

-- Rick

On Feb 26, 2010, at 1:28 AM, Paolo Bonzini wrote:


CharacterArray extend [
    asArrayOfSubstrings [
    <category: 'converting'>
        | first last collection |
        
        collection := OrderedCollection new.
        last := 0.
[first := self findFirst: [ :char | char isSeparator not] startingAt:
last + 1. first ~= 0]
                whileTrue:
                        [last := (self findFirst: [ :char | char isSeparator] 
startingAt:
first) - 1.
                        last<  0 ifTrue: [last := self size].
                        collection add: (self copyFrom: first to: last)].
        ^collection asArray

Missing closing bracket here:

   ]
]

Paolo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]