SequenceableCollection.st
changeset 6054 7719f857af51
parent 6027 2ef25097672f
child 6118 bea02c0010f5
--- a/SequenceableCollection.st	Wed Sep 26 18:33:08 2001 +0200
+++ b/SequenceableCollection.st	Wed Sep 26 18:52:14 2001 +0200
@@ -1696,6 +1696,7 @@
     "
      #($a $b $c $d $e $f $g) copyFrom:2
      '1234567890' copyFrom:2
+     (10 to:19) copyFrom:5  
     "
 !
 
@@ -1734,6 +1735,7 @@
     "
      #($a $b $c $d $e $f $g) copyFrom:2 to:5
      '1234567890' copyFrom:2 to:5
+     (1 to:10) copyFrom:2 to:5  
     "
 !
 
@@ -1756,6 +1758,7 @@
     "return a copy of the receiver, where all elements equal to oldElement
      have been replaced by newElement."
 
+"/    'Warning: #copyReplaceAll:with: will change semantics as defined in ANSI soon' errorPrintCR.
     ^ self copy replaceAll:oldElement with:newElement
 
     "
@@ -1775,6 +1778,8 @@
 
     |s|
 
+"/    'Warning: #copyReplaceAll:withAll: will change semantics as defined in ANSI soon' errorPrintCR.
+
     s := WriteStream on:self species new.
     self do:[:el |
         el = oldObject ifTrue:[
@@ -1798,7 +1803,6 @@
      '123123abc123' copyReplaceAll:$1 withAll:'one'    
      #(1 2 3 4 1 2 3 4) copyReplaceAll:1 withAll:'one' 
     "
-
 !
 
 copyReplaceFrom:startIndex to:endIndex with:aCollection
@@ -1833,6 +1837,19 @@
     "
 !
 
+copyReplacing:oldElement withObject:newElement
+    "return a copy of the receiver, where all elements equal to oldElement
+     have been replaced by newElement.
+     ANSI version of what used to be #copyReplaceAll:with:"
+
+    ^ self copy replaceAll:oldElement with:newElement
+
+    "
+     #(1 2 1 2 1 2 1 2 1 2) copyReplacing:1 withObject:99 
+     'hello world' copyReplacing:$l withObject:$*         
+    "
+!
+
 copyThrough:element
     "return a new collection consisting of the receiver elements
      up-to (AND including) the first occurence of element."
@@ -5303,6 +5320,6 @@
 !SequenceableCollection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.154 2001-09-12 11:10:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.155 2001-09-26 16:51:56 cg Exp $'
 ! !
 SequenceableCollection initialize!