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: Paolo Bonzini
Subject: Re: [Help-smalltalk] Easiest way to add new methods to kernel classes (from within a script)?
Date: Fri, 26 Feb 2010 10:28:41 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100120 Fedora/3.0.1-1.fc12 Lightning/1.0b2pre Thunderbird/3.0.1


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]