longestCommonPrefix - failed if there was no common prefix at all.
authorClaus Gittinger <cg@exept.de>
Sun, 02 Mar 1997 00:23:00 +0100
changeset 2434 0a84bd4173c2
parent 2433 6eeced763de2
child 2435 08f60d7c2c11
longestCommonPrefix - failed if there was no common prefix at all.
Coll.st
Collection.st
--- a/Coll.st	Sat Mar 01 23:53:56 1997 +0100
+++ b/Coll.st	Sun Mar 02 00:23:00 1997 +0100
@@ -1450,6 +1450,7 @@
             ^ try
         ].
         matchLen := matchLen - 1.
+        matchLen == 0 ifTrue:[^ ''].
         try := try copyTo:matchLen.
     ].
     ^ try
@@ -1461,7 +1462,7 @@
      #( (1 2 3 4) (1 2 3) (1 2 3 7) (1 2 3 9 10 11)) longestCommonPrefix
     "
 
-    "Modified: 22.4.1996 / 13:04:56 / cg"
+    "Modified: 2.3.1997 / 00:21:41 / cg"
 ! !
 
 !Collection methodsFor:'testing'!
@@ -1619,6 +1620,6 @@
 !Collection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/Coll.st,v 1.67 1997-02-12 13:17:41 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/Coll.st,v 1.68 1997-03-01 23:23:00 cg Exp $'
 ! !
 Collection initialize!
--- a/Collection.st	Sat Mar 01 23:53:56 1997 +0100
+++ b/Collection.st	Sun Mar 02 00:23:00 1997 +0100
@@ -1450,6 +1450,7 @@
             ^ try
         ].
         matchLen := matchLen - 1.
+        matchLen == 0 ifTrue:[^ ''].
         try := try copyTo:matchLen.
     ].
     ^ try
@@ -1461,7 +1462,7 @@
      #( (1 2 3 4) (1 2 3) (1 2 3 7) (1 2 3 9 10 11)) longestCommonPrefix
     "
 
-    "Modified: 22.4.1996 / 13:04:56 / cg"
+    "Modified: 2.3.1997 / 00:21:41 / cg"
 ! !
 
 !Collection methodsFor:'testing'!
@@ -1619,6 +1620,6 @@
 !Collection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.67 1997-02-12 13:17:41 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.68 1997-03-01 23:23:00 cg Exp $'
 ! !
 Collection initialize!