join
Todd Blanchard
tblanchard at mac.com
Fri Sep 15 03:54:09 UTC 2006
OK
splitOn: aString
| idx lastIdx |
idx := lastIdx := 1.
^Array streamContents:
[:s |
[idx <= self size] whileTrue:
[
idx := self findString: aString startingAt: lastIdx.
idx = 0 ifTrue: [idx := self size + 1].
s nextPut: (self copyFrom: lastIdx to: idx-1).
lastIdx := idx + aString size.
]
]
On Sep 14, 2006, at 8:48 PM, Ramon Leon wrote:
>> Poking around a frequently used image I find:
>> String>>splitOn: aString
>> and
>> SequenceableCollection>>joinOn: aString
>> And I use them quite a bit when processing input.
>
> Care to share your #splitOn:, my #split: was just a synonym for
> #findTokens: which I recently realized didn't do what I thought it
> did.
>
>
More information about the Squeak-dev
mailing list
|