On Mon, Dec 20, 2010 at 1:31 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Huh, I forgot multibyte characters... Then would this be sufficient?
Character>>hex   value >255     ifTrue: [^value hex]     ifFalse: [^value printStringBase: 16 nDigits: 2]
geoffroy
we cannot really change hex because hex returns     16rXXX
and the other classes are consistent with that.
(Character value: 12345) hex     '16r3039'
Integer>>hex     "Print the receiver as hex, prefixed with 16r.  DO NOT CHANGE THIS!  The Cog VMMaker depends on this.     Consider using any of         printStringHex         printStringBase: 16         printStringBase: 16 length: 8 padded: true         storeStringHex         storeStringBase: 16         storeStringBase: 16 length: 11 padded: true"     ^self storeStringBase: 16
Now what we could have is another method named:     xxPrintStringHex     for example (first name that came to my mind)     paddedPrintStringHex
1566 printStringHex '61E'
15 printStringHex  'F'
1566 paddedPrintStringHex '61E'
15 paddedPrintStringHex  '0F'
Or something like that.
I was using Pharo 1.1, where PrintStringHex is not implemented. In the patch for issue 3466, I modified printStringHex, but a new function including padding might be a better idea. Until Pharo 1.2 is published, I'll keep my custom code to display hexadecimal strings.