Its not base 'r'. its base 16. In Smalltalk you use 'r' to denote the fact that your specifying the base (radix) (https://en.wikipedia.org/wiki/Radix) of a number. So Igor was pointing out that for the hexadecimal representation of the decimal number 10 you use 16rA For the binary representation of the decimal number 10 you use 2r00001010 and for octal its 8r12 so when he says <base>r<number> he's just pointing out the pattern I show when showing you how to manipulate the decimal number 10 in base 16, 2, and 8 above. Also to see what a number is in a different base (radix) use this: 10 radix: 4 or 16rA radix: 10 2r00001010 radix: 10 8r12 radix: 10 hope this helps Paul On 03/15/2013 06:35 AM, Mohammad Al Houssami (Alumni) wrote:
Im new to smalltalk so im not sure how you derived the numbers. So if I have 000A as a unicode how do I do the transformation? I donât know how you got 2r10101101 16rA
And what are base r and number in <base>r<number> ?
Thanks again Mohammad
-----Original Message----- From: pharo-users-bounces@lists.gforge.inria.fr [mailto:pharo-users-bounces@lists.gforge.inria.fr] On Behalf Of Igor Stasenko Sent: Friday, March 15, 2013 12:54 PM To: A friendly place where any question about pharo is welcome Subject: Re: [Pharo-users] Unicode in Smalltalk
On 15 March 2013 13:44, Mohammad Al Houssami (Alumni) <mha53@mail.aub.edu> wrote:
Im not sure where you got the 16r0026 from. What I have is something like this U+0009 CHARACTER TABULATION (tab) U+000A LINE FEED (LF) U+000C FORM FEED (FF) U+0020 SPACE
Whats on the left is the unicode representation. In some cases there is no actual character to compare to( so I cant compare to < > &....) What I will have to do is to create a character with unicode value U+000A. I have tried myCharacter:= 000A asCharacter. But it doesn't work.
When I try to print myCharacter it gives an error because it doesn't understand the A.
because 000A is not valid literal in smalltalk. it is actually understood by compiler as unary message: 0 A
if you want to use hexadecimal integer litrals, you should use radix notation:
<base>r<number>
try:
2r10101101 16rA
Thanks Mohammad
-- Best regards, Igor Stasenko.