Ok it's just that I didn’t understand the notation he used. Its clear now. I 
know about radix and bases and all this stuff but it’s the notation that got me 
confused. The whole thing was just changing the notations from base 16 to base 
10. I tried it and it works. 

Thank you Paul and Igor. 


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Paul DeBruicker
Sent: Friday, March 15, 2013 2:04 PM
To: A friendly place where any question about pharo is welcome
Subject: Re: [Pharo-users] Unicode in Smalltalk

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: [email protected] 
> [mailto:[email protected]] 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) <[email protected]> 
> 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.
> 
> 



Reply via email to