PeekableStream.st
changeset 25096 9af9383ce171
parent 24943 ed3437bdaa73
equal deleted inserted replaced
25095:ed06cbc9f0b8 25096:9af9383ce171
   950      value."
   950      value."
   951 
   951 
   952     |result|
   952     |result|
   953 
   953 
   954     result := self upToBeforeAny:aCollectionOfObjects.
   954     result := self upToBeforeAny:aCollectionOfObjects.
   955     self atEnd ifFalse:[
   955     self nextOrNil.
   956         self next.
       
   957     ].
       
   958     ^ result
   956     ^ result
   959 
   957 
   960     "
   958     "
   961      |s|
   959      |s|
   962      s := ReadStream on:'hello world'.
   960      s := ReadStream on:'hello world'.
   964      Transcript showCR:(s upToEnd)
   962      Transcript showCR:(s upToEnd)
   965 
   963 
   966      'Makefile' asFilename readStream upToAny:($A to:$Z)
   964      'Makefile' asFilename readStream upToAny:($A to:$Z)
   967     "
   965     "
   968 
   966 
   969     "Created: / 30.8.1997 / 03:02:05 / cg"
   967     "Created: / 30-08-1997 / 03:02:05 / cg"
   970     "Modified: / 11.1.1998 / 15:19:18 / cg"
   968     "Modified: / 11-01-1998 / 15:19:18 / cg"
       
   969     "Modified: / 11-12-2019 / 22:08:02 / Stefan Vogel"
   971 !
   970 !
   972 
   971 
   973 upToBeforeAny:aCollectionOfObjects
   972 upToBeforeAny:aCollectionOfObjects
   974     "read a collection of all objects up to an element that is contained in
   973     "read a collection of all objects up to an element that is contained in
   975      aCollectionOfObjects and return these elements, but excluding the matching one.
   974      aCollectionOfObjects and return these elements, but excluding the matching one.