Andreas Raab uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ar.120.mcz==================== Summary ====================
Name: Collections-ar.120
Author: ar
Time: 27 August 2009, 8:07:54 am
UUID: f7e07320-f92c-9449-ad4a-98813876258b
Ancestors: Collections-dtl.119
PositionableStream>>upToAnyOf: is just like #upTo: but allows for a collection of elements to be matched against. Very useful when there is a potential set of matches ahead, for example when dealing with a mixture of cr and lfs in files, such as in:
[stream atEnd] whileFalse:[
(stream upToAnyOf: String crlf) ifNotEmpty:[:line| "etc"].
].
=============== Diff against Collections-dtl.119 ===============
Item was added:
+ ----- Method: PositionableStream>>upToAnyOf: (in category 'accessing') -----
+ upToAnyOf: aCollection
+ "Answer a subcollection from the current access position to the
+ occurrence (if any, but not inclusive) of any object in the collection. If
+ no matching object is found, answer the entire rest of the receiver."
+ | newStream element |
+ newStream := WriteStream on: (collection species new: 100).
+ [self atEnd or: [aCollection includes: (element := self next)]]
+ whileFalse: [newStream nextPut: element].
+ ^newStream contents!