class: SequenceableCollection
authorClaus Gittinger <cg@exept.de>
Mon, 23 Jun 2014 11:41:18 +0200
changeset 16611 fceeb99e31df
parent 16610 31c545ff56ec
child 16612 6207587e6d07
class: SequenceableCollection added: #upToSeparator
SequenceableCollection.st
--- a/SequenceableCollection.st	Mon Jun 23 11:38:58 2014 +0200
+++ b/SequenceableCollection.st	Mon Jun 23 11:41:18 2014 +0200
@@ -4754,6 +4754,20 @@
     "
 !
 
+upToSeparator
+    "Return the next elements up to but not including the next separator.
+     The next read will return the separator.
+     If no separator is encountered, the contents up to the end is returned.
+     The elements are supposed to understand #isSeparator 
+     (i.e. the receiver is supposed to be a character-stream)."
+
+    ^ self upToElementForWhich:[:ch | ch isSeparator]
+
+    "
+     'hello world' upToSeparator
+    "
+!
+
 withoutLeadingForWhich:aCheckBlock
     "return a copy of myself without leading elements for which aCheckBlock returns true.
      Returns an empty collection, if the receiver consist only of matching elements.
@@ -9747,11 +9761,11 @@
 !SequenceableCollection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.382 2014-06-23 09:38:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.383 2014-06-23 09:41:18 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.382 2014-06-23 09:38:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.383 2014-06-23 09:41:18 cg Exp $'
 ! !