Re: [julia-users] binary string to hex

2015-12-04 Thread Martin Somers

>
> Yeh looking for some means of concatenaing binary bits together - was 
>> think of using a string but can find a method, function to do it 
>
>
sorry Mauro but your suggestion is just a transformation - I need a little 
more control on the binary bits 

cheers 
M  


Re: [julia-users] binary string to hex

2015-12-04 Thread Seth
That works, but I'm concerned with the part of the original post that says 
" I want to change some of the bits and get a hex back"

I'm hoping that the OP's plan to "change bits" is not realized by changing 
the string representation, but rather changing the bit representation 
(using << and >> and/or bitwise operators). 

S.

On Friday, December 4, 2015 at 4:49:09 AM UTC-8, Mauro wrote:
>
> This works: 
>
> julia> a = 0b1010 
> 0xaf 
>
> julia> parse("0b"*bin(a)) 
> 0xaf 
>
> but maybe there are better ways. 
>
> On Fri, 2015-12-04 at 13:33, Martin Somers  > wrote: 
> > Just wondering binary to hex 
> > a = 0b1010 
> > bin(a) >  "1010" 
> > 
> > this results in a string that can be accessed with [] notation 
> > 
> > is there an easy way to go backwards I want to change some of the bits 
> and 
> > get a hex back 
> > 
> > M 
>


Re: [julia-users] binary string to hex

2015-12-04 Thread Mauro
This works:

julia> a = 0b1010
0xaf

julia> parse("0b"*bin(a))
0xaf

but maybe there are better ways.

On Fri, 2015-12-04 at 13:33, Martin Somers  wrote:
> Just wondering binary to hex
> a = 0b1010
> bin(a) >  "1010"
>
> this results in a string that can be accessed with [] notation
>
> is there an easy way to go backwards I want to change some of the bits and
> get a hex back
>
> M


[julia-users] binary string to hex

2015-12-04 Thread Martin Somers
Just wondering binary to hex
a = 0b1010
bin(a) >  "1010"

this results in a string that can be accessed with [] notation 

is there an easy way to go backwards I want to change some of the bits and 
get a hex back 

M