Fix collect:, add expandTabs.
authorStefan Vogel <sv@exept.de>
Wed, 14 Feb 1996 12:12:28 +0100
changeset 187 485f6f0036f7
parent 186 bc1b056b097c
child 188 74c8f104cd71
Fix collect:, add expandTabs.
StrColl.st
--- a/StrColl.st	Sat Feb 10 16:33:26 1996 +0100
+++ b/StrColl.st	Wed Feb 14 12:12:28 1996 +0100
@@ -11,10 +11,10 @@
 "
 
 OrderedCollection subclass:#StringCollection
-	 instanceVariableNames:''
-	 classVariableNames:''
-	 poolDictionaries:''
-	 category:'Collections-Text'
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Collections-Text'
 !
 
 !StringCollection class methodsFor:'documentation'!
@@ -120,6 +120,36 @@
 	].
 	start := stop + 2
     ]
+!
+
+withTabsExpanded
+    ^ self collect:[:string|
+        string notNil ifTrue:[
+            string withTabsExpanded     
+        ] ifFalse:[
+            string
+        ]
+    ]
+
+    "
+       |tab|
+       tab := String with:Character tab.
+       ('abcd', tab, 'tef', tab, 'tgh') asStringCollection withTabsExpanded
+    "
+
+    "Created: 12.2.1996 / 22:25:56 / stefan"
+    "Modified: 14.2.1996 / 11:13:01 / stefan"
+! !
+
+!StringCollection methodsFor:'copying'!
+
+copyEmpty:size
+    "we have to redefine this, since 'self class new:size' does allocate size nil lines.
+     In order to get collect working, we have to undo this allocation"
+
+    ^ (super copyEmpty:size) grow:0.
+
+    "Created: 14.2.1996 / 11:05:47 / stefan"
 ! !
 
 !StringCollection methodsFor:'printing'!
@@ -150,5 +180,5 @@
 !StringCollection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Attic/StrColl.st,v 1.21 1995-12-10 00:40:53 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Attic/StrColl.st,v 1.22 1996-02-14 11:12:28 stefan Exp $'
 ! !