--- a/CharacterArray.st Wed Feb 02 19:09:45 2000 +0100
+++ b/CharacterArray.st Wed Feb 02 21:14:05 2000 +0100
@@ -3901,27 +3901,29 @@
the original receiver is returned unchanged.
(sounds complicated ? -> see examples below)."
- |s idx n|
+ |s idx n rest|
idx := self indexOf:decimalCharacter.
idx == 0 ifTrue:[
- "/
- "/ no decimal point found; adjust string to the left of the period column
- "/
- rightPadChar isNil ifTrue:[
- s := self , (self species new:afterPeriod + 1 withAll:leftPadChar)
- ] ifFalse:[
- s:= self , decimalCharacter asString , (self species new:afterPeriod withAll:rightPadChar).
- ].
+ "/
+ "/ no decimal point found; adjust string to the left of the period column
+ "/
+ rightPadChar isNil ifTrue:[
+ s := self , (self species new:afterPeriod + 1 withAll:leftPadChar)
+ ] ifFalse:[
+ s:= self , decimalCharacter asString , (self species new:afterPeriod withAll:rightPadChar).
+ ].
] ifFalse:[
- "/ the number of after-decimalPoint characters
- n := self size - idx.
- rightPadChar isNil ifTrue:[
- s := self , (self species new:afterPeriod - n withAll:leftPadChar).
- ] ifFalse:[
- s := self , (self species new:afterPeriod - n withAll:rightPadChar).
- ].
+ "/ the number of after-decimalPoint characters
+ n := self size - idx.
+ rest := afterPeriod - n.
+ rest > 0 ifTrue:[
+ s := (self species new:rest withAll:(rightPadChar ? leftPadChar)).
+ ] ifFalse:[
+ s := ''
+ ].
+ s := self , s.
].
^ s leftPaddedTo:size with:leftPadChar
@@ -5480,6 +5482,6 @@
!CharacterArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.176 2000-01-31 18:59:25 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.177 2000-02-02 20:14:05 cg Exp $'
! !
CharacterArray initialize!