so could you write two tests and submit a slice so that we improve the system
Stef
convertFromBase: sourceBase to: targetBase
Convert the receiver (who has to represent a number string) from the
given source base to
the given target base
''
On Feb 15, 2013, at 1:51 AM, Benjamin wrote:
On Feb 15, 2013, at 1:40 AM, Torsten Bergmann asta...@gmx.de wrote:
This was just an example to play with since you asked
for a #convertFromBase:to: method in your original mail
and one cant provide such a method on Number. Your
original
On 15 Feb 2013, at 11:11, Henrik Johansen henrik.s.johan...@veloxit.no wrote:
On Feb 15, 2013, at 1:51 AM, Benjamin wrote:
On Feb 15, 2013, at 1:40 AM, Torsten Bergmann asta...@gmx.de wrote:
This was just an example to play with since you asked
for a #convertFromBase:to: method in your
On Feb 15, 2013, at 11:24 AM, Sven Van Caekenberghe s...@stfx.eu wrote:
On 15 Feb 2013, at 11:11, Henrik Johansen henrik.s.johan...@veloxit.no
wrote:
On Feb 15, 2013, at 1:51 AM, Benjamin wrote:
On Feb 15, 2013, at 1:40 AM, Torsten Bergmann asta...@gmx.de wrote:
This was just an
On 15.02.2013 11:29, Benjamin wrote:
On Feb 15, 2013, at 11:24 AM, Sven Van Caekenberghe s...@stfx.eu wrote:
On 15 Feb 2013, at 11:11, Henrik Johansen henrik.s.johan...@veloxit.no wrote:
On Feb 15, 2013, at 1:51 AM, Benjamin wrote:
On Feb 15, 2013, at 1:40 AM, Torsten Bergmann
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
Hi Ben,
use that:
2r11 printStringBase: 10
- 3
16r11 printStringBase: 10
-17
Cheers,
Jannik
On Feb 14, 2013, at 10:05 PM, Benjamin benjamin.vanryseghem.ph...@gmail.com
wrote:
Hi guys, I know it sounds stupid but how do I convert numbers from one base
to another ?
I found
3
Hi Benjamin,
from your example I guess you know how to convert from decimal (base 10) to
binary (base 2):
9 printStringBase: 2
gives you the binary representation/bit string: '1001'.
If I understand your post correctly you want the other way around and you want
to
get the decimal value
Add this method to String class:
convertFromBase: sourceBase to: targetBase
Convert the receiver (who has to represent a number string) from the
given source base to
the given target base
'' convertFromBase: 16 to: 2
On 14 Feb 2013, at 22:05, Benjamin benjamin.vanryseghem.ph...@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
On 15 Feb 2013, at 00:09, Torsten Bergmann asta...@gmx.de wrote:
convertFromBase: sourceBase to: targetBase
Convert the receiver (who has to represent a number string) from the
given source base to
the given target base
'' convertFromBase:
Sven wrote:
So something like this should work:
(Integer readFrom: 'FF' base: 16) printStringBase: 2
Integer readFrom: 'FF' will not work since #readFrom: expects a string in
decimal representation
and 'FF' is hexadecimal. It also wont work for large numbers due to sending it
to Integer.
Euh, sure this works:
(Number readFrom: 'FF' base: 16) printStringBase: 2
Number class#readFrom:base:
Integer class#readFrom:base:
On 15 Feb 2013, at 00:26, Torsten Bergmann asta...@gmx.de wrote:
Sven wrote:
So something like this should work:
(Integer readFrom: 'FF' base: 16)
Euh, sure this works:
(Number readFrom: 'FF' base: 16) printStringBase: 2
Yes, one has to use Number instead of Integer and #readFrom:base:
#readFrom: works too if you already have the string in source base
representation, e.g. '16rFF'.
The timing is good - currently work on the literal
Thank you guys :)
I feel a little less dumb :)
(even if it's not really natural for me to have this behaviour on string but ^^)
Ben
On Feb 15, 2013, at 12:33 AM, Sven Van Caekenberghe s...@stfx.eu wrote:
Euh, sure this works:
(Number readFrom: 'FF' base: 16) printStringBase: 2
Number
This was just an example to play with since you asked
for a #convertFromBase:to: method in your original mail
and one cant provide such a method on Number. Your
original request
11 convertFromBase: 2 to: 10
may work - but it wont work for hex values:
FF convertFromBase: 16 to: 10
then FF
On Feb 15, 2013, at 1:40 AM, Torsten Bergmann asta...@gmx.de wrote:
This was just an example to play with since you asked
for a #convertFromBase:to: method in your original mail
and one cant provide such a method on Number. Your
original request
11 convertFromBase: 2 to: 10
may work
17 matches
Mail list logo