Feb. 14, 2013
11:12 p.m.
On 14 Feb 2013, at 22:05, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote:
Hi guys, I know it sounds stupid but how do I convert numbers from one base to another ?
I found
3 printStringBase: 2 -> '11'
But I would like something like
11 convertFromBase: 2 to: 10 -> 3
The Finder did help me about this one so I ask here :)
Thanks in advance,
Ben
It is not the number itself that is in some base, but its representation. So you have to convert from one string representation to another. So something like this should work: (Integer readFrom: 'FF' base: 16) printStringBase: 2 Sven -- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill