class: PrintConverter
changed: #print:formattedBy:
Use CharacterWriteStream for Unicode compatibility
--- a/PrintConverter.st Thu Apr 02 10:48:31 2015 +0000
+++ b/PrintConverter.st Wed Apr 22 20:03:20 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1995 by Claus Gittinger
All Rights Reserved
@@ -9,8 +11,9 @@
other person. No title to or ownership of the software is
hereby transferred.
"
+"{ Package: 'stx:libview2' }"
-"{ Package: 'stx:libview2' }"
+"{ NameSpace: Smalltalk }"
Object subclass:#PrintConverter
instanceVariableNames:'valueToStringBlock stringToValueBlock type'
@@ -229,25 +232,25 @@
into formatString, where #-characters are replaced by
successive characters from the printString.
Warning: use with care - it does not check for decimal points etc.
- the printString of aNumber must have enough digits for all
- #-characters to be replaced.
- Therefore, precheck the numbers value and use appropriate format
- strings then.
+ the printString of aNumber must have enough digits for all
+ #-characters to be replaced.
+ Therefore, precheck the numbers value and use appropriate format
+ strings then.
For number formatting, see also: printfPrintString: implementations."
|pS fS out|
pS := ReadStream on:aNumber printString.
fS := ReadStream on:formatString.
- out := WriteStream on:String new.
+ out := WriteStream on:(formatString species new:100).
[fS atEnd] whileFalse:[
- |c|
+ |c|
- c := fS next.
- c == $# ifTrue:[
- c := pS next
- ].
- out nextPut:c
+ c := fS next.
+ c == $# ifTrue:[
+ c := pS next
+ ].
+ out nextPut:c
].
^ out contents
@@ -465,5 +468,6 @@
!PrintConverter class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/PrintConverter.st,v 1.18 2001-04-20 09:47:43 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/PrintConverter.st,v 1.19 2015-04-22 18:03:20 stefan Exp $'
! !
+