#BUGFIX by stefan
authorStefan Vogel <sv@exept.de>
Wed, 25 Oct 2017 11:26:24 +0200
changeset 22325 e9fba9f05c31
parent 22324 61d66473b029
child 22326 3326c18b05a5
#BUGFIX by stefan class: CharacterArray changed: #compareAsVersionNumberWith: Fix if argument is not a string
CharacterArray.st
--- a/CharacterArray.st	Tue Oct 24 14:47:09 2017 +0200
+++ b/CharacterArray.st	Wed Oct 25 11:26:24 2017 +0200
@@ -347,6 +347,7 @@
     "Created: 3.8.1997 / 18:16:40 / cg"
 ! !
 
+
 !CharacterArray class methodsFor:'cleanup'!
 
 lowSpaceCleanup
@@ -608,6 +609,7 @@
     "
 ! !
 
+
 !CharacterArray class methodsFor:'pattern matching'!
 
 matchEscapeCharacter
@@ -1013,6 +1015,7 @@
     ^ Unicode32String
 ! !
 
+
 !CharacterArray methodsFor:'Compatibility-ANSI'!
 
 addLineDelimiters
@@ -2364,6 +2367,8 @@
     rev1 := self asCollectionOfSubstringsSeparatedBy:$..
     aStringOrCollection isString ifTrue:[
         rev2 := aStringOrCollection asCollectionOfSubstringsSeparatedBy:$..
+    ] ifFalse:[
+        rev2 := aStringOrCollection.
     ].
     rev1 := rev1 collect:[:each| each asInteger].
     rev2 := rev2 collect:[:each| each asInteger].
@@ -2379,7 +2384,7 @@
                 ].
             ].
 
-            trailingZerosCount > 0 ifTrue:[
+            trailingZerosCount ~~ 0 ifTrue:[
                 numbers copyTo:numbers size - trailingZerosCount
             ] ifFalse:[
                 numbers
@@ -2406,7 +2411,10 @@
      self assert:('1.2.3.4' compareAsVersionNumberWith:'1.2.3.4') = 0.
      self assert:('1.2.3.4' compareAsVersionNumberWith:'01.002.03.004') = 0.
      self assert:('1.2.3.4' compareAsVersionNumberWith:#(1 2 3 4)) = 0.
-    "
+     self assert:('1.2.3.4' compareAsVersionNumberWith:#('1' 2 3 4)) = 0.
+    "
+
+    "Modified: / 25-10-2017 / 11:25:08 / stefan"
 !
 
 compareCaselessWith:aString
@@ -4952,6 +4960,8 @@
 ! !
 
 
+
+
 !CharacterArray methodsFor:'matching - glob expressions'!
 
 compoundMatch:aString
@@ -6428,6 +6438,7 @@
     "Modified: 17.4.1997 / 12:50:23 / cg"
 ! !
 
+
 !CharacterArray methodsFor:'special string converting'!
 
 asUnixFilenameString
@@ -7453,23 +7464,6 @@
     "
 !
 
-withoutSuffix:aString
-    "if the receiver endsWith aString, return a copy without it.
-     Otherwise return the receiver"
-
-    (self endsWith:aString) ifTrue:[
-        ^ self copyButLast:aString size
-    ].
-    ^ self
-
-    "
-     'helloworld' withoutSuffix:'world'
-     'helloworld' withoutSuffix:'foo'
-    "
-
-    "Created: / 23-10-2017 / 15:01:37 / cg"
-!
-
 withoutTrailingSeparators
     "return a copy of myself without trailing separators.
      Notice: this does remove tabs, newline or any other whitespace.
@@ -7488,6 +7482,7 @@
     "
 ! !
 
+
 !CharacterArray methodsFor:'substring searching'!
 
 findRangeOfString:subString
@@ -8296,6 +8291,7 @@
     ^ aVisitor visitString:self with:aParameter
 ! !
 
+
 !CharacterArray class methodsFor:'documentation'!
 
 version